-
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
Entry.Reload doesn't reload owned object. #16186
Comments
@AndriySvyryd I think this issue still exists. Please try the following steps:
|
@AndriySvyryd - Can you suggest where and how should I add a test for this? |
@smitpatel Optimistic concurrency tests would be an appropriate place, there should already be owned types in the model. |
@AndriySvyryd Which nuget package of the EFCore has included this fix? I have tried Microsoft.EntityFrameworkCore v3.1.0-preview1.19506.2 and it doesn't work for my case. |
@IvanZheng You need to get the nightly build of v3.1.0-preview2 |
@AndriySvyryd I tried 3.1.0-preview2.19522.3 just now. It still doesn't work. Only the root level properties will be reloaded but the owned objects won't. |
@IvanZheng You need to call Reload on the owned entry, not the root: entry.Reference(e => e.Address).TargetEntry.Reload(); #13890 tracks reloading the aggregate as a whole |
@AndriySvyryd Thank you! It works well for owned object now. I use a recursive method to reload all aggregate's entities and value objects as below. But I find another issue. If the number of the entities in CollectionEntry changed, is there a way to reload the entities in CollectionEntry? Currently it only reloads the loaded entities. I will track #13890 and hope it provide a better way to reload whole aggregate.
|
@IvanZheng Reloading collections is tracked by #13620 You might be better off just querying the whole aggregate again. |
@AndriySvyryd Thanks again! Follow the post of stackoverflow in #13620, I can reload collections.
|
I think this issue it was underestimated. I think that is counter-intuitive that I have to explicitly reload the owned types. |
Entry.Reload doesn't reload owned object.
Further technical details
EF Core version: 3.0.0-preview5.19227.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Visual Studio 2019 16.1.3
The text was updated successfully, but these errors were encountered: