属性在更新值时更改为null

时间:2010-04-30 15:36:53

标签: linq-to-sql

我正在通过一个类来检索Data对象,该类是linq到sql的部分类。

我使用相同的对象模型来更新更改。但是对于这个对象,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,



            });

1 个答案:

答案 0 :(得分:0)

解决方案是

the object which created is localized one and it  needs to be attached into original object.