Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

understanding change tracking in EF Core #31007

Closed
Bykiev opened this issue May 31, 2023 · 2 comments
Closed

understanding change tracking in EF Core #31007

Bykiev opened this issue May 31, 2023 · 2 comments

Comments

@Bykiev
Copy link

Bykiev commented May 31, 2023

Hi, I'm migrating our project from EF 6 to Ef.Core. We've used GraphDiff library to update the whole entity graph in disconnected scenarios (it's a web app), it's really good, but not supported in EF.Core.

As many developers, we faced with this annoying error "the instance of entity type cannot be tracked because another instance with the key value is already being tracked" on updating entities. I understand that this entity is already being tracked by EF Core, but is any reasons throwing exception instead of updating the entity in internal dictionary or removing from it? It's even really hard to detect where the entity was previously loaded and I think it should be implemented in EF Core, not any workaround in end developers code to detect this. It's an ORM framework and it should hide all complexity from developers.

@Bykiev
Copy link
Author

Bykiev commented May 31, 2023

I have found now it's possible to make own IIdentityResolutionInterceptor and built-in UpdatingIdentityResolutionInterceptor can be used to always update values

upd: here you can find more information about this issue: https://learn.microsoft.com/en-us/ef/core/change-tracking/identity-resolution

@ajcvickers
Copy link
Member

Duplicate of #20124

@ajcvickers ajcvickers marked this as a duplicate of #20124 Jun 4, 2023
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants