-
Notifications
You must be signed in to change notification settings - Fork 226
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
JSON POCO Save Changes does not update props in JSON #1228
Comments
I have same issue, updating any json property or adding element to array does not update json object in DB |
Because JSON documents can be arbitrarily large, we don't enable automatic change detection on them (more precisely, we don't define a value comparer that does value comparison). If we did, that means that would mean that we would do a snapshot of every JSON document loaded from the database, and a deep comparison against the snapshot once SaveChanges is called. This would be extremely bad for perf. You can manually flag the JSON document as modified yourself: ctx.Entry(designHubProject).Property(b => b.SectionStatuses).IsModified = true; Note that your last snippet has Note that support for change-tracking proxies has been implemented on the EF Core side; this means that when 5.0 comes out, you may be able to have automated change tracking without snapshot and comparison, by wrapping your JsonDocument/JsonElement by a proxy. |
thanks @roji was able to implement what you pointed out |
That's retarded tbh and completely not in line with how rest of EF Core works and completely unexpected behavior. What's the proper way to get it handled? And no, changing the state to modifed is NOT the proper way to solve it, EF Core is behind a repository and the code/Entity containing it doesn't have any knowledge of EF Core internals. |
Version v3.1.0
The DB does not get modified
The text was updated successfully, but these errors were encountered: