Table of Contents

Enum ChangeTrackingStrategy

Namespace
Microsoft.EntityFrameworkCore
Assembly
Microsoft.EntityFrameworkCore.dll

Indicates how the context detects changes to properties for an instance of the entity type.

public enum ChangeTrackingStrategy

Fields

ChangedNotifications = 1

To use this strategy, the entity class must implement INotifyPropertyChanged. Original values are recorded when an entity is queried from the database. Properties are marked as modified when the entity raises the PropertyChanged event.

ChangingAndChangedNotifications = 2

To use this strategy, the entity class must implement INotifyPropertyChanged and INotifyPropertyChanging. Original values are recorded when the entity raises the PropertyChanging event. Properties are marked as modified when the entity raises the PropertyChanged event.

ChangingAndChangedNotificationsWithOriginalValues = 3

To use this strategy, the entity class must implement INotifyPropertyChanged and INotifyPropertyChanging. Original values are recorded when the entity raises the PropertyChanging. Properties are marked as modified when the entity raises the PropertyChanged event.

Snapshot = 0

Original values are recorded when an entity is queried from the database. Changes are detected by scanning the current property values and comparing them to the recorded values. This scanning takes place when DetectChanges() is called, or when another API call (such as SaveChanges()) triggers the change detection process.

Remarks

See Change detection and notifications for more information and examples.