efcore
efcore copied to clipboard
Json Columns initial work
Finished work:
- basic metadata,
- property/navigation access translation,
- materialization (entity, collection, with nesting),
- honoring json property name attribute for custom naming
- validation,
Remaining work:
- migration,
- update,
- collections of primitives,
- array access/operations (force non-tracking!)
- some metadata fixes (e.g. using actual type mapping for properties mapped to json, rather than default mappings), flowing json type info (npgsql),
- custom serialization (???),
- lots of fixes, cleanups, documentation,
- testing (WIP)
blocked:
- json owned entity having navigation to non-owned entity
- json collection with ordinal key explicitly defined
- inheritance (apart from TPH)
- table splitting
When you add validation also throw if an entity type is mapped to JSON, but the principal type is not mapped to a table or view (and add a note to support this for raw SQL and function mappings in #19970 and #21627)
Add a test to RelationalModelTest that has nested JSON types and some of the column names are the same on between levels
Requires actual query tests.
Why don't we not allow projection member binding for JsonEntityExpression?
Are we planning to support navigations from inside the JSON document outside and vice versa? If so, I didn't think this would be part of a 1st version - it certainly hasn't been requested on the PG side (and sounds complicated).
It came up yesterday and we need to have a nice design meeting discussion about it
Add validation for not allowing JSON column for TPT/TPC
👍
private readonly IDictionary<ParameterExpression, IDictionary<IProperty, int>> _materializationContextBindings
can make these all dictionaries concrete Dictionary type?
Refers to: src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs:133 in b40e728. [](commit_id = b40e7283c5f6382b7b5d062fc75d0f8019043d37, deletion_comment = False)
var isTph = entityType.FindDiscriminatorProperty() != null;
@AndriySvyryd can we just use mapping strategy method now?
Refers to: src/EFCore.Relational/Metadata/Internal/RelationalModel.cs:364 in d0f43e3. [](commit_id = d0f43e38a4e320169e272647f08526532e9c8be9, deletion_comment = False)
@AndriySvyryd can we just use mapping strategy method now?
Yes
Is this draft ready for review yet? So we can really start commenting
earlierClientProjectionCount = _clientProjections.Count;
This is where we do process after lifting from single result subquery. Recompute the dedupe map here from this point to end point.
Refers to: src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs:846 in f2ab2b9. [](commit_id = f2ab2b9ba510d47ab49e39f8d4b325cfd19873ae, deletion_comment = False)
cc: @AndriySvyryd to review metadata/update pipeline changes.