Skip to content

Commit

Permalink
Entity equality: fix mis-identification as collection navigation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
roji committed Aug 27, 2019
1 parent 561ce5c commit 1121f6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1085,16 +1085,15 @@ public EntityReferenceExpression(Expression underlying, Dictionary<string, Entit
}

public EntityReferenceExpression(Expression underlying, IEntityType entityType)
: this(underlying, entityType, null, false)
: this(underlying, entityType, subqueryTraversed: false)
{
}

private EntityReferenceExpression(
Expression underlying, IEntityType entityType, INavigation lastNavigation, bool subqueryTraversed)
Expression underlying, IEntityType entityType, bool subqueryTraversed)
{
Underlying = underlying;
EntityType = entityType;
_lastNavigation = lastNavigation;
SubqueryTraversed = subqueryTraversed;
}

Expand Down Expand Up @@ -1126,6 +1125,7 @@ public virtual Expression TraverseProperty(string propertyName, Expression desti
destinationExpression,
navigation.GetTargetType(),
navigation,
null,
SubqueryTraversed)
: destinationExpression;
}
Expand All @@ -1146,7 +1146,7 @@ public virtual Expression TraverseProperty(string propertyName, Expression desti
}

public EntityReferenceExpression Update(Expression newUnderlying)
=> new EntityReferenceExpression(newUnderlying, EntityType, _lastNavigation, DtoType, SubqueryTraversed);
=> new EntityReferenceExpression(newUnderlying, EntityType, null, DtoType, SubqueryTraversed);

protected override Expression VisitChildren(ExpressionVisitor visitor)
=> Update(visitor.Visit(Underlying));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1121f6a

Please sign in to comment.