Share via


DbChangeTracker.HasChanges Method

Definition

Checks if the DbContext is tracking any new, deleted, or changed entities or relationships that will be sent to the database if SaveChanges() is called.

public bool HasChanges ();
member this.HasChanges : unit -> bool
Public Function HasChanges () As Boolean

Returns

True if underlying DbContext have changes, else false.

Remarks

Functionally, calling this method is equivalent to checking if there are any entities or relationships in the Added, Updated, or Deleted state. Note that this method calls DetectChanges() unless AutoDetectChangesEnabled has been set to false.

Applies to