dotnet / dotnet/efcore

Query: Update original and current values of tracked objects' unchanged properties (MergeOptions.PreserveChanges)

Open
#35,844 2 comments 0 reactions 0 assignees View on GitHub
area-change-tracking
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

To use some ancient EF4 terminology, today's EF Core query behavior uses `MergeOptions.AppendOnly`. This means that new entities are materialized and attached to the state manager while any entities that already exist in the state manager (as identified by their key) are returned as is. This means that any new property values returned by the query are essentially discarded.

I would like the option of using the `PreserveChanges` behavior. This would update the original and current values of any existing entities' unchanged properties. This is obviously more computationally expensive, but I suspect it will be offset by the memory allocations saved in comparison to existing new-DbContext/NoTracking/ChangeTracker.Clear workarounds.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.