Closed
Description
openedon Jul 27, 2023
Currently there is an issue when projecting collection of primitives from JSON entities (specifically, nested ones) - problem is in shared type expanding visitor - we don't correctly handle includes that the JSON type gets expanded to - in case of other navigations we can successfully bind them, in case of primitive non-collections we just ignore them (the includes), but in case of collection of primitives we leave them as they are but fail to reason about them correctly in the translation phase.
example
ss.Set<JsonEntityBasic>()
.OrderBy(x => x.Id)
.Select(x => x.OwnedCollectionRoot
.Where(xx => xx.Name == "Foo")
.Select(xx => new { xx.Names, xx.Numbers })
.ToList())
throws:
Translation of 'EF.Property<string[]>(IncludeExpression(
EntityExpression:
IncludeExpression(
EntityExpression:
EntityShaperExpression:
TestModels.JsonQuery.JsonEntityBasic.OwnedCollectionRoot#JsonOwnedRoot
ValueBufferExpression:
ProjectionBindingExpression: EmptyProjectionMember
IsNullable: False
,
NavigationExpression:
MaterializeCollectionNavigation(
Navigation: JsonEntityBasic.OwnedCollectionRoot#JsonOwnedRoot.OwnedCollectionBranch,
subquery: o.OwnedCollectionBranch Q->
.AsQueryable()
.Select(o0 => IncludeExpression(
EntityExpression:
IncludeExpression(
EntityExpression:
o0,
NavigationExpression:
MaterializeCollectionNavigation(
Navigation: JsonEntityBasic.OwnedCollectionRoot#JsonOwnedRoot.OwnedCollectionBranch#JsonOwnedBranch.OwnedCollectionLeaf,
subquery: EF.Property<List<JsonOwnedLeaf>>(o0, "OwnedCollectionLeaf")
.AsQueryable()), OwnedCollectionLeaf)
,
NavigationExpression:
EF.Property<JsonOwnedLeaf>(o0, "OwnedReferenceLeaf"), OwnedReferenceLeaf)
)), OwnedCollectionBranch)
,
NavigationExpression:
IncludeExpression(
EntityExpression:
IncludeExpression(
EntityExpression:
EntityShaperExpression:
TestModels.JsonQuery.JsonEntityBasic.OwnedCollectionRoot#JsonOwnedRoot.OwnedReferenceBranch#JsonOwnedBranch
ValueBufferExpression:
o.OwnedReferenceBranch Q->
IsNullable: True
,
NavigationExpression:
MaterializeCollectionNavigation(
Navigation: JsonEntityBasic.OwnedCollectionRoot#JsonOwnedRoot.OwnedReferenceBranch#JsonOwnedBranch.OwnedCollectionLeaf,
subquery: o.OwnedReferenceBranch Q-> OwnedCollectionLeaf
.AsQueryable()), OwnedCollectionLeaf)
,
NavigationExpression:
EntityShaperExpression:
TestModels.JsonQuery.JsonEntityBasic.OwnedCollectionRoot#JsonOwnedRoot.OwnedReferenceBranch#JsonOwnedBranch.OwnedReferenceLeaf#JsonOwnedLeaf
ValueBufferExpression:
o.OwnedReferenceBranch Q-> OwnedReferenceLeaf
IsNullable: True
, OwnedReferenceLeaf)
, OwnedReferenceBranch)
, "Names")' failed. Either the query source is not an entity type, or the specified property does not exist on the entity type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment