Entity Framework 4.0 GetChanges() equivalent

試著忘記壹切 提交于 2019-12-23 07:44:40

问题


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.

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()


回答1:


Found it.

ObjectContext.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Added); for inserts.



来源:https://stackoverflow.com/questions/2928500/entity-framework-4-0-getchanges-equivalent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!