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

Entity equality: handle non-anonymous types in projection #16789

Closed
roji opened this issue Jul 27, 2019 · 2 comments · Fixed by #16791
Closed

Entity equality: handle non-anonymous types in projection #16789

roji opened this issue Jul 27, 2019 · 2 comments · Fixed by #16791
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

@roji
Copy link
Member

roji commented Jul 27, 2019

We currently handle projecting through anonymous types, but not non-anonymous types. We should visit the MemberInitExpression and perform entity equality rewriting.

Examples:

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Entity_equality_through_DTO_projection(bool isAsync)
    => AssertQuery<Order>(
        isAsync,
        o => o
            .Select(o => new OrderDTO { Customer = o.Customer })
            .Where(x => x.Customer != null),
        entryCount: 89);

private class OrderDTO
{
    public Customer Customer { get; set; }
}

Raised in #16719, thanks @smitpatel for first analysis.

@roji roji added the type-bug label Jul 27, 2019
roji added a commit that referenced this issue Jul 27, 2019
Also various modifications to support MemberMemberBinding better.

Fixes #16789
roji added a commit that referenced this issue Jul 27, 2019
Also various modifications to support MemberMemberBinding better.

Fixes #16789
@roji roji self-assigned this Jul 27, 2019
roji added a commit that referenced this issue Jul 27, 2019
Also various modifications to support MemberMemberBinding better.

Fixes #16789
@ajcvickers ajcvickers added this to the 3.0.0 milestone Jul 29, 2019
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 30, 2019
roji added a commit that referenced this issue Jul 30, 2019
MemberAssignmentBinding only for now.

Fixes #16789
roji added a commit that referenced this issue Jul 30, 2019
MemberAssignmentBinding only for now.

Fixes #16789
roji added a commit that referenced this issue Jul 31, 2019
MemberAssignmentBinding only for now.

Fixes #16789
roji added a commit that referenced this issue Jul 31, 2019
MemberAssignmentBinding only for now.

Fixes #16789
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview9 Aug 21, 2019
@fschlaef
Copy link

Confirmed working with 3.0.0-rc1 👍

@roji
Copy link
Member Author

roji commented Aug 26, 2019

Thanks for the confirmation!

@ajcvickers ajcvickers modified the milestones: 3.0.0-preview9, 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.

3 participants