Efcore: Entity equality: handle non-anonymous types in projection

Created on 27 Jul 2019  路  2Comments  路  Source: dotnet/efcore

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

Examples:

```c#
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Entity_equality_through_DTO_projection(bool isAsync)
=> AssertQuery(
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.

closed-fixed type-bug

Most helpful comment

Confirmed working with 3.0.0-rc1 馃憤

All 2 comments

Confirmed working with 3.0.0-rc1 馃憤

Thanks for the confirmation!

Was this page helpful?
0 / 5 - 0 ratings