[英]Updating a Detached Entity Instance using Entity Framework 4.0
I am utilizing Entity Framework 4.0 and WCF. 我正在使用Entity Framework 4.0和WCF。 I am new to using Entity Framework and am more familiar with NHibernate. 我是使用Entity Framework的新手,对NHibernate更熟悉。 However, I am concerned about detached instances of objects when performing an update. 但是,我担心执行更新时对象的分离实例。
I have looked on various websites where they retrieve an object, attach the instance to their context, and set all properties to be modified but this leaves two problems: 我查看了各种网站,他们检索对象,将实例附加到其上下文,并设置要修改的所有属性,但这留下了两个问题:
Is there a 'best practice' example of how to handle updating detached entity instances? 是否存在如何处理更新分离实体实例的“最佳实践”示例? Any guidance is greatly appreciated. 非常感谢任何指导。
Brandon, are you able to make use of the self-tracking entities template? Brandon,您能够使用自我跟踪实体模板吗? This is designed to make handling updates of detached entities much easier. 这旨在使分离实体的处理更新变得更加容易。 http://msdn.microsoft.com/en-us/library/ee789839.aspx http://msdn.microsoft.com/en-us/library/ee789839.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.