Change detection

Most of the time change-tracking works exactly as you’d expect it to, but there are a few wrinkles to the change-tracking mechanism that you should be aware of, just in case you run into a situation in which it doesn’t:

Change-tracking mechanisms

There are two methods of change-tracking used by the Entity Framework: SNAPSHOT TRACKING, which compares the current and original values of properties during SaveChanges() and PROXY TRACKING, which notifies Entity Framework of changes as they occur. The ObjectContext API always uses proxy tracking, which means that changes that you make to an entity are always handled immediately.

When you use the DbContext API, Entity Framework will use snapshot tracking unless your entity classes comply ...

Get Fluent Entity Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.