-
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
Query: Convert SetOperator.Source2 from EntityQueryable to QueryModel… #8061
Conversation
|
||
if (querySourceReferenceExpression != null | ||
&& querySourceReferenceExpression.ReferencedQuerySource == groupJoinClause) | ||
if (additionalFromClause?.FromExpression is QuerySourceReferenceExpression querySourceReferenceExpression && querySourceReferenceExpression.ReferencedQuerySource == groupJoinClause) |
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.
nit: formatting (add newline before &&
)
break; | ||
|
||
case ConcatResultOperator concatResultOperator | ||
when IsEntityQueryable(concatResultOperator.Source2): |
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.
nit: make indentations consistent
|
||
private static SubQueryExpression ConvertEntityQueryableToSubQuery(Expression expression) | ||
{ | ||
var mainFromClause = new MainFromClause("set_" + _setOperatorCount++, expression.Type.GenericTypeArguments[0], expression); |
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.
add some funky characters to the name that would prevent clashes, just like relinq does for their generated item names (e.g. "<set_1>"
) - and add suitable test
b4e9bf9
to
efece73
Compare
Updated. |
|
||
private static bool IsEntityQueryable(Expression expression) | ||
{ | ||
return expression is ConstantExpression constantExpression |
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.
is constantExpression guaranteed to be of generic type? Otherwise this line will throw. Maybe add defensive check.
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.
Done. Added check to verify if the type is generic.
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.
DRY this with other 3 places in stack.
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.
For reference #8074
efece73
to
41e3fba
Compare
6c29c70
to
71c2106
Compare
… when applicable. This causes issue when translating EntityQueryable to SelectExpression as there is no query source.
71c2106
to
52ac479
Compare
private static SubQueryExpression ConvertEntityQueryableToSubQuery(Expression expression) | ||
{ | ||
var mainFromClause = new MainFromClause( | ||
$"<set>_{_setOperatorCount++}", |
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.
Use a better name? Type name
… when applicable.
This causes issue when translating EntityQueryable to SelectExpression as there is no query source.
resolves #7279