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: projected collection navigations don't get tracked if the collection is composed on #8999

Closed
maumar opened this issue Jun 28, 2017 · 2 comments · Fixed by #17725
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-2.0 type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Jun 28, 2017

Related to #7131

We currently preform fixup if the collection is projected direcly (by using include pipeline), however if it's composed on, we don't.

e.g.:

context.Parents.Select(p => new {Parent = p, p.Children.Where(c => c.IsNaughty)}).ToList();

We should either change the way we do fixup for those cases, or improve the logic that converts collection projections to includes to incorporate more cases (esp. filters)

@maumar maumar changed the title Query: projected collection navigation don't get tracked if the collection is composed on Query: projected collection navigations don't get tracked if the collection is composed on Jun 28, 2017
@ajcvickers ajcvickers modified the milestone: Backlog Jun 29, 2017
@julielerman
Copy link

julielerman commented Dec 16, 2017

Bad news...I thought this was fixed but with 2.0.1, I'm back to this old problem.
In this query:

 _context.Samurais.Select(s =>
                   new { Samurai = s, Quotes = s.Quotes })
                   .ToList();

The resulting object's Samurai is aware of its quotes.

But when I filter the quotes ala

 _context.Samurais.Select(s =>
                   new { Samurai = s, Quotes = s.Quotes.Where(q => q.Text.Contains("happy")) })
                   .ToList();

The object's quote property has the quotes, but it's samurai's quotes property is empty.

Even if I explicitly append ToList() to the subquery

 var happySamurais = _context.Samurais.Select(s =>
                   new { Samurai = s, Quotes = s.Quotes.Where(q => q.Text.Contains("happy")).ToList() })
                   .ToList();

The fixup isn't happening.

So if I am interpolating correctly, there is still no way to filter related data in projections unless there is some new construct that I haven't happened upon yet.

@AndriySvyryd AndriySvyryd added the verify-fixed This issue is likely fixed in new query pipeline. label Aug 22, 2019
@smitpatel smitpatel self-assigned this Sep 4, 2019
@ajcvickers ajcvickers modified the milestones: Backlog, 3.1.0 Sep 4, 2019
@smitpatel smitpatel added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed verify-fixed This issue is likely fixed in new query pipeline. labels Sep 9, 2019
smitpatel added a commit that referenced this issue Sep 9, 2019
smitpatel added a commit that referenced this issue Sep 9, 2019
@smitpatel smitpatel modified the milestones: 3.1.0, 3.0.0 Sep 9, 2019
@julielerman
Copy link

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-2.0 type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants