ASP.NET MVC3 Code-First Error- attempting to update entity

后端 未结 2 1645
北恋
北恋 2021-01-03 10:10

I\'ve checked this question and it seems to be related to what I need, but does not answer it exactly.

I have an entity (Sql Compact using EF Code First via MVC3- if

2条回答
  •  猫巷女王i
    2021-01-03 10:53

    If the CreateDate and CreatedBy fields are not in the edit form, the update action object will not have the db values.

    The additional call to the db and resetting, as Ed's answer describes, can be avoided if you include those fields in the edit form. Then the normal model binding should pick them up and give them back to you on the update.

提交回复
热议问题