首页 > 其他 > 详细

EF Repository Update

时间:2016-09-02 11:26:15      阅读:227      评论:0      收藏:0      [点我收藏+]

问题描述:


技术分享

解决办法:


http://www.cnblogs.com/scy251147/p/3688844.html

原理:



Attaching an entity of type ‘‘ failed because another entity of the same type already has the same primary key value. This can happen when using the ‘Attach‘ method or setting the state of an entity to ‘Unchanged‘ or ‘Modified‘ if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the ‘Add‘ method or the ‘Added‘ entity state to track the graph and then set the state of non-new entities to ‘Unchanged‘ or ‘Modified‘ as appropriate.

EF Repository Update

原文:http://www.cnblogs.com/luomingui/p/5832515.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!