TrackGraph stop tracking if current State is not set, but setting state throw InvalidOperationException #8226
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
In our situation, we have to work with TrackGraph method because we have mapping between Domain and Persistence layer.
The fact is, in case of update, we look in local tracking entries to retrieve value and update it if necessary
In case of update, we enter the function with a Detached entity, retrieve the corresponding local instance and then updating it. However, because we're not setting the state of current entering entity in
TrackGraph
method, the TrackGraph method ends here ( https://github.com/aspnet/EntityFramework/blob/dev/src/EFCore/ChangeTracking/ChangeTracker.cs indicates that State should be different of Detached)Is this possible to make Callback a
Func<EntityEntryGraphNode, bool>
to indicate continuation instead of relaying on the State ? Or maybe to have both method signatures ...In my case, if I set State directly on the e.Entry, I've got and
InvalidOperationException
because Entity is currently tracked with the same key.I've already tried to detach local entity, but the thing is, when I set state to my current entity, I have a
InvalidOperationException
at next node when callingContext.ChangeTracker.Entries()
.Further technical details
EF Core version: 1.1.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: VS 2017
The text was updated successfully, but these errors were encountered: