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

Filtered child entities in projection are not tracked #10124

Closed
havotto opened this issue Oct 19, 2017 · 3 comments
Closed

Filtered child entities in projection are not tracked #10124

havotto opened this issue Oct 19, 2017 · 3 comments
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

@havotto
Copy link

havotto commented Oct 19, 2017

When child entities are filtered in a projection, these child entities are not tracked, but added to the parent's navigation collection. Also, the inverse navigation properties are not fixed up.

This issue is quite related to issue 7131

Steps to reproduce

Here is the repo with tests for details: Repo

Further technical details

EF Core version: 2.0.0
Database Provider: Microsoft.EntityFrameworkCore.Sqlite
Operating system: Win 10
IDE: Visual Studio 2017

@ajcvickers
Copy link
Member

Note for triage:
In this case, Child entities are tracked:

var result = ctx.Parents.Select(p =>
new
{
    Parent = p,
    Children = p.Children
})
.First();

In this case, Child entities are not tracked:

var result = ctx.Parents.Select(p =>
new
{
    Parent = p,
    Children = p.Children.Where(c => c.Name.Length > 0).ToList()
})
.First();

@anpete
Copy link
Contributor

anpete commented Oct 20, 2017

Similar to #7569. @maumar is there a dupe of this?

@ajcvickers ajcvickers added this to the 2.1.0 milestone Oct 20, 2017
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview1, 2.1.0 Jan 17, 2018
@maumar maumar removed this from the 2.1.0 milestone Feb 7, 2018
@maumar
Copy link
Contributor

maumar commented Feb 7, 2018

fixed in b95f23f

@maumar maumar closed this as completed Feb 7, 2018
@maumar maumar added this to the 2.1.0 milestone Feb 7, 2018
@divega divega added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Apr 7, 2018
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview2, 2.1.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

No branches or pull requests

5 participants