Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 4.0 GetChanges() equivalent

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

like image 547
Jonathan Avatar asked May 28 '10 11:05

Jonathan


People also ask

Is ef6 still supported?

Although Entity Framework 6. x is still supported, it is no longer being developed and will only receive fixes for security issues.

Is .NET 4.8 backwards compatible?

Backward compatibility. The . NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework.

How do you configure entity framework for optimistic concurrency?

If you do want to implement this approach to concurrency, you have to mark all non-primary-key properties in the entity you want to track concurrency for by adding the ConcurrencyCheck attribute to them. That change enables the Entity Framework to include all columns in the SQL WHERE clause of UPDATE statements.


1 Answers

Found it.

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

like image 120
Jonathan Avatar answered Sep 25 '22 21:09

Jonathan