Change Tracking

SkillDev tools

This skill gives your coding agent guidance on how EF Core tracks entity changes internally before saving to a database. With it, your AI can work on core internals like InternalEntityEntry, ChangeDetector, and SnapshotFactoryFactory correctly. It is aimed at code involving entity state, snapshots, and property accessors.

Available today. Use it from your connected AI after setup.

Add the skill, then ask your coding agent to make changes to EF Core internals such as InternalEntityEntry or ChangeDetector. It will follow the documented change-tracking patterns while it works.

Then ask your AI: use the Change Tracking skill

What your AI can do with it

  • Work on InternalEntityEntry and ChangeDetector code
  • Modify SnapshotFactoryFactory correctly
  • Handle entity state and snapshot code
  • Update property accessor code

What this skill tells your AI

The instructions your AI receives, as published by dotnet/efcore in .agents/skills/change-tracking/SKILL.md and read by ahel’s review.

Manages entity states and detects changes for SaveChanges().

Core Components

  • StateManager — central engine, identity maps, tracks all entities
  • InternalEntityEntry — per-entity state, property flags, snapshots
  • SnapshotFactoryFactory subclasses build snapshot factories for change detection
  • PropertyAccessorsFactory, ClrPropertyGetterFactory and ClrPropertySetterFactory compile property accessors for efficient snapshotting and change detection
    • Ordinals in indices parameter specify element at each complex collection depth

Testing

Unit tests: test/EFCore.Tests/ChangeTracking/. Functional tests: test/EFCore.Specification.Tests/GraphUpdates/.

Common Pitfalls

PitfallSolution
There is a failure when there is shared identity entry (Added and Deleted)Add code that checks SharedIdentityEntry

Validation

  • DetectChanges() identifies modified properties via snapshot comparison
  • Setting original values marks properties as modified or unchanged based on comparison with current values

Signals

GitHub stars
15k
Forks
3k
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
change-tracking
Source
github.com/dotnet/efcore