a blog for those who code

Thursday, 3 July 2014

Get list of modified objects in Entity Framework : C#

If you want to get the list of modified objects in Entity Framework, you can do using the below mentioned code.

List<object> newlyAddedOrModifiedEntities = context.ChangeTracker.Entries().Where(x => x.State == System.Data.EntryState.Modified || x.State == System.Data.EntryState.Added).Select(a=>a.Entity).ToList();

Please Like and Share the Blog, if you find it interesting and helpful.

No comments:

Post a Comment