共用方式為


ChangeTrackingStrategy Enum

Definition

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

public enum ChangeTrackingStrategy
type ChangeTrackingStrategy = 
Public Enum ChangeTrackingStrategy
Inheritance
ChangeTrackingStrategy

Fields

Name Value Description
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.

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.

Remarks

See Change detection and notifications for more information and examples.

Applies to