QueryTrackingBehavior Enum

Definition

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

public enum QueryTrackingBehavior
type QueryTrackingBehavior = 
Public Enum QueryTrackingBehavior
Inheritance
QueryTrackingBehavior

Fields

NoTracking 1

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 not be performed. If an entity with a given key is in different result in the result set then they will be different instances.

NoTrackingWithIdentityResolution 2

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 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 0

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

Applies to