Delen via


ChangeTracker.AutoDetectChangesEnabled Property

Definition

Gets or sets a value indicating whether the DetectChanges() method is called automatically by methods of DbContext and related classes.

public virtual bool AutoDetectChangesEnabled { get; set; }
member this.AutoDetectChangesEnabled : bool with get, set
Public Overridable Property AutoDetectChangesEnabled As Boolean

Property Value

Remarks

The default value is true. This ensures the context is aware of any changes to tracked entity instances before performing operations such as SaveChanges() or returning change tracking information. If you disable automatic detect changes then you must ensure that DetectChanges() is called when entity instances have been modified. Failure to do so may result in some changes not being persisted during SaveChanges() or out-of-date change tracking information being returned.

See EF Core change tracking for more information and examples.

Applies to