开发者

EF4 does not commit Updates

开发者 https://www.devze.com 2023-01-21 00:06 出处:网络
Sorry to ask such a general question: what can cause EF to insert records but not update ? I face a strange situation where i change an entity and when i call SaveChanges(), the changes are no开发者_

Sorry to ask such a general question: what can cause EF to insert records but not update ?

I face a strange situation where i change an entity and when i call SaveChanges(), the changes are no开发者_运维技巧t committed in the DB. thanks Jon


Are you keeping the ObjectContext alive for the entire lifetime of your entities? If not, when you re-attach the entities to a new ObjectContext for saving, the changes made may not be reflected and the entities may not be considered dirty.


Do you have a primary key defined?

0

精彩评论

暂无评论...
验证码 换一张
取 消