ChangeTracker.StateChanged Event


An event fired when an entity that is tracked by the associated DbContext has moved from one EntityState to another.

public event EventHandler<Microsoft.EntityFrameworkCore.ChangeTracking.EntityStateChangedEventArgs> StateChanged;
member this.StateChanged : EventHandler<Microsoft.EntityFrameworkCore.ChangeTracking.EntityStateChangedEventArgs> 
Public Custom Event StateChanged As EventHandler(Of EntityStateChangedEventArgs) 

Event Type


Note that this event does not fire for entities when they are first tracked by the context. Use the Tracked event to get notified when the context begins tracking an entity.

See EF Core change tracking for more information and examples.

Applies to