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: Include on client projection gets ignored #16231

Closed
smitpatel opened this issue Jun 24, 2019 · 0 comments · Fixed by #16345
Closed

Query: Include on client projection gets ignored #16231

smitpatel opened this issue Jun 24, 2019 · 0 comments · Fixed by #16345
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

[ConditionalFact]
        public virtual Task Multiple_includes_with_client_method_around_qsre_and_also_projecting_included_collection()
        {
            using (var ctx = CreateContext())
            {
                var query = ctx.Squads
                    .Include(s => s.Members)
                    .ThenInclude(g => g.Weapons)
                    .Where(s => s.Name == "Delta")
                    .Select(s => new { s.Name, Client(s).Members });

                var result = query.ToList();

                Assert.Equal(1, result.Count);

                var topLevel = result[0];

                Assert.Equal(4, topLevel.Members.Count);
                Assert.True(topLevel.Members.First().Weapons.Count > 0);
            }

            return Task.CompletedTask;
        }
IQueryable<<>f__AnonymousType233<string, ICollection<Gear>>> Select(
|__ source: IQueryable<Squad> Where(
|   |__ source: DbSet<Squad>, 
|   |__ predicate: (Squad s) => s.Name == "Delta"), 
|__ selector: (Squad s) => new { 
        Name = s.Name, 
        Members = Squad (GearsOfWarQueryTestBase<GearsOfWarQuerySqlServerFixture>)GearsOfWarQuerySqlServerTest.Client(s).Members
     })
maumar added a commit that referenced this issue Jun 26, 2019
Problem was that when we search and apply include on the final projection we short circuit when we encounter member access. However, we should only do that if the member access is on top of navigation binding - in other cases, like client-side functions, we should peek inside and potentially apply includes on entities that are defined there.
maumar added a commit that referenced this issue Jun 28, 2019
Problem was that when we search and apply include on the final projection we short circuit when we encounter member access. However, we should only do that if the member access is on top of navigation binding - in other cases, like client-side functions, we should peek inside and potentially apply includes on entities that are defined there.
maumar added a commit that referenced this issue Jun 28, 2019
Problem was that when we search and apply include on the final projection we short circuit when we encounter member access. However, we should only do that if the member access is on top of navigation binding - in other cases, like client-side functions, we should peek inside and potentially apply includes on entities that are defined there.
@ajcvickers ajcvickers added this to the 3.0.0 milestone Jun 28, 2019
smitpatel pushed a commit that referenced this issue Jun 28, 2019
Problem was that when we search and apply include on the final projection we short circuit when we encounter member access. However, we should only do that if the member access is on top of navigation binding - in other cases, like client-side functions, we should peek inside and potentially apply includes on entities that are defined there.
smitpatel added a commit that referenced this issue Jun 28, 2019
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 28, 2019
smitpatel added a commit that referenced this issue Jun 28, 2019
smitpatel added a commit that referenced this issue Jun 28, 2019
smitpatel added a commit that referenced this issue Jun 28, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview7, 3.0.0 Nov 11, 2019
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. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants