-
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
Cosmos: Fix reference nested owned entities in queries #16276
Conversation
@smitpatel Could you check whether this is the correct approach? |
_materializationContextBindings[parameterExpression] = Expression.Convert( | ||
CreateReadJTokenExpression(_jObjectParameter, projection.Alias), | ||
typeof(JObject)); | ||
_materializationContextBindings[parameterExpression] = _jObjectParameter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work when you have projected out multiple entities in projection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should. Is there a test for that?
shaperBody = new CosmosProjectionBindingRemovingExpressionVisitor(selectExpression, jObjectParameter) | ||
.Visit(shaperBody); | ||
var jObjectParameter = Expression.Parameter(typeof(JObject), "jObject"); | ||
var shaperBody = new CosmosProjectionBindingRemovingExpressionVisitor(selectExpression, jObjectParameter, this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep injecting materializer and binding removal separate?
We can have another visitor which inject nested entityshapers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my original design, but we need to add the jObject variable before each materializer is injected.
src/EFCore.Cosmos/Query/Pipeline/CosmosShapedQueryCompilingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
b0f3ac7
to
309bcb9
Compare
309bcb9
to
125ec92
Compare
125ec92
to
6bfeedc
Compare
@smitpatel Updated |
It would be good to have EntityShaper not worry about nested part and at some point before compiling, we injected nested entityShaper in the tree directly. (possibly re-using includeExpression), |
Ok, I'll check this in as is and try that while adding collection support. |
No description provided.