等效的Entity Framework 4.0 GetChanges() [英] Entity Framework 4.0 GetChanges() equivalent
问题描述
在LINQ to SQL中,您可以重写SubmitChanges并使用this.GetChangeSet()方法获取所有插入,更新和删除操作,以便您可以在最后一刻进行更改,然后再将其提交给数据库。
In LINQ to SQL, you can override SubmitChanges and use the method this.GetChangeSet() to get all the inserts, updates and deletes so that you can make last minute changes before it is committed to the database.
可以在EF 4.0中完成吗?我看到有一个SaveChanges的替代项,但我需要知道GetChangeSet()的等效项。
Can this be done in EF 4.0? I see there is a override for SaveChanges but I need to know the equivalent for GetChangeSet()
推荐答案
找到了它。
ObjectContext.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Added);
ObjectContext.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Added); for inserts.
这篇关于等效的Entity Framework 4.0 GetChanges()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!