-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
ef core created an instance for each element in a one to many relationship with the same foreign key #21208
Comments
but this fork's without duplications. Each roads (r) contains many statements
|
No tracking query does not perform identity resolution. See https://docs.microsoft.com/en-us/ef/core/querying/tracking#identity-resolution Also see #19877 |
@smitpatel, Without .AsNoTracking does not work either. that was the first thing I checked |
@dpr-dev - Please provide a runnable repro code. |
So, it seems like our two choices are:
Is there a way to enforce/approximate the weak references mentioned at the end of the linked doc above? Everything I read says to disable change tracking on read-only queries to help return results faster, but nothing mentions this behavior (granted, most of those articles were for EF Core 2.x). |
@tiesont - Starting with EF Core preview5 new API is added. It is called |
@smitpatel I assume that means that there is no way to mimic that behavior, now? |
The only way to do that now is to initialize new DbContext to run the query and then throw away the context. |
Hi. I have a two classes
This query created many instances for the parent entity (Road) with the same foreign key. as a result, I got a million identical roads (instead of one)
Further technical details
Operating system: Windows
Packages:
The text was updated successfully, but these errors were encountered: