From 1121f6af98e9f0d29bbcdfb3a3f00b575a92f6f1 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Tue, 27 Aug 2019 17:16:30 +0200 Subject: [PATCH] Entity equality: fix mis-identification as collection navigation We now flow the last navigation only for pure traversal (via member, EF.Property) and not for Select and others. This corrects valid entity references which were misidentified as collection navigations. Fixes #17229 --- .../Internal/EntityEqualityRewritingExpressionVisitor.cs | 8 ++++---- .../Query/ComplexNavigationsQueryTestBase.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EFCore/Query/Internal/EntityEqualityRewritingExpressionVisitor.cs b/src/EFCore/Query/Internal/EntityEqualityRewritingExpressionVisitor.cs index 5f50489fa7b..6606a28f279 100644 --- a/src/EFCore/Query/Internal/EntityEqualityRewritingExpressionVisitor.cs +++ b/src/EFCore/Query/Internal/EntityEqualityRewritingExpressionVisitor.cs @@ -1085,16 +1085,15 @@ public EntityReferenceExpression(Expression underlying, Dictionary new EntityReferenceExpression(newUnderlying, EntityType, _lastNavigation, DtoType, SubqueryTraversed); + => new EntityReferenceExpression(newUnderlying, EntityType, null, DtoType, SubqueryTraversed); protected override Expression VisitChildren(ExpressionVisitor visitor) => Update(visitor.Visit(Underlying)); diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs index cd7fae99fa1..7433840c774 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs @@ -4981,7 +4981,7 @@ public virtual void Include_inside_subquery() } } - [ConditionalTheory(Skip = "Issue #17229")] + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Select_optional_navigation_property_string_concat(bool isAsync) {