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: Tuples are not translatable to Sql. Client Eval them #9522

Merged
merged 1 commit into from
Aug 22, 2017

Conversation

smitpatel
Copy link
Contributor

Fixes #9424

var ids = new[] { Tuple.Create(1, 2), Tuple.Create(10248, 11) };

AssertQuery<OrderDetail>(
cd => cd.Where(c => ids.Contains(new Tuple<int, int>(c.OrderID, c.ProductID))), entryCount: 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

cd -> od
c -> od

What happens with normal anonymous type for this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also fails. Needs different solution.

*/
if ((!expression.Type.IsGenericType
|| !string.Equals(expression.Type.GetGenericTypeDefinition().DisplayName(), typeof(Tuple).DisplayName()))
&& expression.Members != null
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do the anonymous type expansion?

@smitpatel
Copy link
Contributor Author

Updated

@@ -907,7 +907,7 @@ protected override Expression VisitSubQuery(SubQueryExpression expression)
|| fromExpression.NodeType == ExpressionType.NewArrayInit)
{
var containsItem = Visit(contains.Item)?.RemoveConvert();
if (containsItem != null)
if (containsItem != null && !containsItem.Type.Equals(typeof(Expression[])))
Copy link
Contributor

Choose a reason for hiding this comment

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

== :trollface:

@smitpatel
Copy link
Contributor Author

Added more tests. We are not translating equality in Where for anonymous/tuple.

@smitpatel
Copy link
Contributor Author

@anpete - Ping!

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.

3 participants