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

Query: Convert SetOperator.Source2 from EntityQueryable to QueryModel… #8061

Merged
merged 1 commit into from
Apr 4, 2017

Conversation

smitpatel
Copy link
Contributor

… when applicable.

This causes issue when translating EntityQueryable to SelectExpression as there is no query source.

resolves #7279


if (querySourceReferenceExpression != null
&& querySourceReferenceExpression.ReferencedQuerySource == groupJoinClause)
if (additionalFromClause?.FromExpression is QuerySourceReferenceExpression querySourceReferenceExpression && querySourceReferenceExpression.ReferencedQuerySource == groupJoinClause)
Copy link
Contributor

@maumar maumar Apr 3, 2017

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):
Copy link
Contributor

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);
Copy link
Contributor

@maumar maumar Apr 4, 2017

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

@smitpatel smitpatel force-pushed the rawentityquerybleinset branch 2 times, most recently from b4e9bf9 to efece73 Compare April 4, 2017 00:10
@smitpatel
Copy link
Contributor Author

Updated.


private static bool IsEntityQueryable(Expression expression)
{
return expression is ConstantExpression constantExpression
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference #8074

@smitpatel smitpatel force-pushed the rawentityquerybleinset branch from efece73 to 41e3fba Compare April 4, 2017 00:14
@smitpatel smitpatel force-pushed the rawentityquerybleinset branch 2 times, most recently from 6c29c70 to 71c2106 Compare April 4, 2017 17:55
… when applicable.

This causes issue when translating EntityQueryable to SelectExpression as there is no query source.
@smitpatel smitpatel force-pushed the rawentityquerybleinset branch from 71c2106 to 52ac479 Compare April 4, 2017 19:46
@smitpatel smitpatel merged commit 52ac479 into dev Apr 4, 2017
@smitpatel smitpatel deleted the rawentityquerybleinset branch April 4, 2017 20:48
private static SubQueryExpression ConvertEntityQueryableToSubQuery(Expression expression)
{
var mainFromClause = new MainFromClause(
$"<set>_{_setOperatorCount++}",
Copy link
Contributor

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

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

Successfully merging this pull request may close these issues.

4 participants