0
我通過將linq中的部分類轉換爲sql的類來檢索Data對象。在更新值時更改爲null的屬性
我使用相同的對象模型來更新更改。但對於此對象,proprertychanging始終爲空。
Anonoymous類型已轉換爲強對象類型。這個強類型會再次更新。
任何人都可以解釋這個原因嗎?
示例代碼:
var questions = from Question in _db.QuestionDataSource
join AnswerType in _db.AnswerTypeDataSource on Question.IN_AnswerTypeId equals AnswerType.IN_AnswerTypeId
join Section in _db.SectionDataSource on
........
orderby Section.IN_Order,Question.VC_Code
select new
{
Question.UI_QuestionID,
Question.VC_Description,
};
----------
ICollection<ICheckListInstanceQuestion> checkListQuestions = new
List<ICheckListInstanceQuestion>();
foreach (var question in questions)
{
checkListQuestions.Add(new CheckListInstanceQuestion
{
UI_QuestionID = question.UI_QuestionID,
VC_Description = question.VC_Description,
});