ChangeTracker.QueryTrackingBehavior Property

Definition

Gets or sets the tracking behavior for LINQ queries run against the context. Disabling change tracking is useful for read-only scenarios because it avoids the overhead of setting up change tracking for each entity instance. You should not disable change tracking if you want to manipulate entity instances and persist those changes to the database using SaveChanges().

public virtual Microsoft.EntityFrameworkCore.QueryTrackingBehavior QueryTrackingBehavior { get; set; }
member this.QueryTrackingBehavior : Microsoft.EntityFrameworkCore.QueryTrackingBehavior with get, set
Public Overridable Property QueryTrackingBehavior As QueryTrackingBehavior

Property Value

Remarks

This method sets the default behavior for the context, but you can override this behavior for individual queries using the AsNoTracking<TEntity>(IQueryable<TEntity>) and AsTracking<TEntity>(IQueryable<TEntity>) methods.

The default value is TrackAll. This means the change tracker will keep track of changes for all entities that are returned from a LINQ query.

Applies to