-
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
IdentityResolution Configuration on AsNoTracking queries #19877
Comments
Team notes: sometimes it is desirable to have full identity resolution in cases where it is not possible to use a tracking query. For example, when diffing the current and database graphs to resolve update resolutions. In these cases the only solution is to spin up a new context for the query. We could instead provide a query mode that automatically spins up a new state manager or similar to do identity resolution. This would leave the default no-tracking case usable as a streaming API without memory issues, while still allowing a different behavior where it is needed. Related: #11564 |
This issue is absolutely underrated already!!! It is a "must-have" to properly resolve (repeating models) when using |
- Uses an adhoc statemanager in the background which is different from statemanager in the context Resolves #19877
- Uses an adhoc statemanager in the background which is different from statemanager in the context Resolves #19877
- Uses an adhoc statemanager in the background which is different from statemanager in the context Resolves #19877
- Uses an adhoc statemanager in the background which is different from statemanager in the context Resolves #19877
This comments might be too late, but here is my take on surfacing this feature. If its a done deal then ignore, but I only found out about this yesterday. I'm not sure how you are going to control the identity resolution added to a Also, you could provide a DbContext-wide setting to switch all |
@JonPSmith - We are going to update the exact API. We discussed about it during API review. Current plan is to add another enum value in
|
New API - AsNoTrackingWithIdentityResolution |
Öhm just asking a dumb question: will this be only available on EF Core 5.0 and higher? |
@ole1986 Yes. |
Identity Resolution is no longer performed with no-tracking queries on EF Core 3: breaking change doc
In some cases, I think that creating several instances of the same object instead of reusing the instance is not optimal in terms of memory usage.
In other cases, such as in recursive objects, you want to be able to enable Identity Resolution to resolve all properties and be able to navigate recursively.
I created a Unit Test that reproduces the recursivity problem in
EF Core 3
withNoTracking
: https://github.com/MADSENSE/Madsense.EFCore.Tests/tree/no-tracking-recursiveRelated issues: #19276, #18570
Proposal
Make
Identity Resolution
configurable when a request is executed withAsNoTracking
.The text was updated successfully, but these errors were encountered: