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

Consider doing full change tracking with JSON DOM mapping #3314

Open
roji opened this issue Oct 13, 2024 · 0 comments
Open

Consider doing full change tracking with JSON DOM mapping #3314

roji opened this issue Oct 13, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@roji
Copy link
Member

roji commented Oct 13, 2024

EFCore.PG has its own JSON mapping mode, which is distinct from EF's JSON support (currently via owned entities and ToJson). When using this mode, EF doesn't automatically detect changes: one has to manually tell EF that a property changed (with ctx.Entry(foo).Property(b => b.Bar).IsModified = true).

In the past, one argument to not do automatic change tracking was performance: JSON documents are arbitrarily large, and so we'd have to perform a deep comparison of those object graphs. However, this is what EF does when mapping with ToJson, so that doesn't seem like a good argument.

A better reason to not go into this, is that there's no good/standard way to actually do deep object graph comparison in .NET - we'd have to use reflection to walk the object graph (that's even slower), and be careful to look only at the properties that EF actually cares about, etc. This is probably in itself unfeasible for POCO mapping.

However, we also support DOM mapping, where users map JsonDocument/JsonElement. In those mode we should be able to perform deep comparison; DOM mapping is also much more relevant, since EFCore.PG's POCO mapping is basically deprecated now that we have EF's ToJson support.

Previous reports: #1228, #1168, #3312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant