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

Fix to #15535 - Query: Navigation rewrite does not preserve the type of result #15951

Merged
merged 1 commit into from
Jun 5, 2019

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Jun 4, 2019

Problem was that we were only storing generic method definition for cardinality reducing operators (First/Single) because nav rewrite changes source types a lot.
However, those operators are applied after pending selector, so they are guaranteed to be of the same type as originally. We only need to track the changes that happen e.g. during member pushdown, e.g.:
customers.FirstOrDefault().Id is changed to customers.Select(c => c.Id).FirstOrDefault()

@maumar maumar requested review from smitpatel and roji June 4, 2019 23:44
@@ -343,12 +346,12 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
{
var navigationKeyAccessExpression = NavigationExpansionHelpers.CreateKeyAccessExpression(
navigationBindingExpression,
navigationBindingExpression.EntityType.FindPrimaryKey().Properties,
new[] { navigationBindingExpression.EntityType.FindPrimaryKey().Properties.First() },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this entire code will be removed once entity equality is in

@maumar maumar force-pushed the fix15535 branch 2 times, most recently from 9a836f0 to ed0057d Compare June 4, 2019 23:49
Copy link
Member

@smitpatel smitpatel left a comment

Choose a reason for hiding this comment

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

:shipit:

…of result

Problem was that we were only storing generic method definition for cardinality reducing operators (First/Single) because nav rewrite changes source types a lot.
However, those operators are applied after pending selector, so they are guaranteed to be of the same type as originally. We only need to track the changes that happen e.g. during member pushdown, e.g.:
customers.FirstOrDefault<Customer>().Id is changed to customers.Select(c => c.Id).FirstOrDefault<int>()
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.

2 participants