QueryTrackingBehavior QueryTrackingBehavior Enum

Indicates how the results of a query are tracked by the ChangeTracker.

Syntax

Declaration

public enum QueryTrackingBehaviorPublic Enum QueryTrackingBehavior

Fields

NoTracking
NoTracking

The change tracker will not track any of the entities that are returned from a LINQ query. If the entity instances are modified, this will not be detected by the change tracker and SaveChanges() will not persist those changes to the database.

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().

Identity resolution will still be performed to ensure that all occurrences of an entity with a given key in the result set are represented by the same entity instance.

TrackAll
TrackAll

The change tracker will keep track of changes for all entities that are returned from a LINQ query. Any modification to the entity instances will be detected and persisted to the database during

SaveChanges().

Details

Assembly

Microsoft.EntityFrameworkCore.dll