change-tracking

Installation
SKILL.md

Change Tracking

Manages entity states and detects changes for SaveChanges().

Core Components

  • StateManager — owns tracked entries, identity/reference maps, fixup, cascades, notifications, and changed counts
  • InternalEntryBase and derived classes — own per-entry state, flags, values, snapshots, and ordered state transitions
  • ChangeDetector — compares current values with baselines and reports changes through entry mutation APIs
  • SnapshotFactoryFactory subclasses — create passive original- and relationship-value baselines
  • IdentityMap — permits one active entry per key; shared identity pairs a replacement with the prior Deleted entry
  • PropertyAccessorsFactory, ClrPropertyGetterFactory and ClrPropertySetterFactory compile property accessors for efficient snapshotting and change detection
    • Ordinals in indices parameter specify element at each complex collection depth

Change Detection

  • Snapshot and notification strategies both call SetPropertyModified() to keep property flags and entity state consistent.
  • SetEntityState() validates values, updates flags and complex entries, changes state, then runs manager bookkeeping hooks.
Installs
48
Repository
dotnet/efcore
GitHub Stars
14.8K
First Seen
Mar 30, 2026