Share via


ChangeTracker.StateChanging Event

Definition

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

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

Event Type

Remarks

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

See EF Core change tracking for more information and examples.

Applies to