Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
return QueryCompilationContext.NotTranslatedExpression;
}

if (!(includeExpression.Navigation is INavigation includableNavigation
&& includableNavigation.IsEmbedded()))
if (includeExpression.Navigation is not INavigation includableNavigation || !includableNavigation.IsEmbedded())
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup only

{
throw new InvalidOperationException(
CosmosStrings.NonEmbeddedIncludeNotSupported(includeExpression.Navigation));
Expand Down Expand Up @@ -459,26 +458,16 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
StructuralTypeShaperExpression? shaperExpression;
switch (visitedSource)
{
case StructuralTypeShaperExpression shaper:
shaperExpression = shaper;
case StructuralTypeShaperExpression s:
shaperExpression = s;
break;

case UnaryExpression unaryExpression:
shaperExpression = unaryExpression.Operand as StructuralTypeShaperExpression;
if (shaperExpression == null
|| unaryExpression.NodeType != ExpressionType.Convert)
{
return QueryCompilationContext.NotTranslatedExpression;
}

case UnaryExpression { NodeType: ExpressionType.Convert, Operand: StructuralTypeShaperExpression s }:
shaperExpression = s;
break;

case ParameterExpression parameterExpression:
if (!_collectionShaperMapping.TryGetValue(parameterExpression, out var collectionShaper))
{
return QueryCompilationContext.NotTranslatedExpression;
}

case ParameterExpression parameterExpression
when _collectionShaperMapping.TryGetValue(parameterExpression, out var collectionShaper):
shaperExpression = (StructuralTypeShaperExpression)collectionShaper.InnerShaper;
break;

Expand Down Expand Up @@ -507,8 +496,7 @@ UnaryExpression unaryExpression
navigationProjection = innerEntityProjection.BindMember(
memberName, visitedSource.Type, clientEval: true, out var propertyBase);

if (propertyBase is not INavigation projectedNavigation
|| !projectedNavigation.IsEmbedded())
if (propertyBase is not INavigation projectedNavigation || !projectedNavigation.IsEmbedded())
{
return QueryCompilationContext.NotTranslatedExpression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ protected override Expression VisitExtension(Expression extensionExpression)

case MaterializeCollectionNavigationExpression:
case IncludeExpression:
case PrimitiveCollectionReference:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix

return extensionExpression;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

Expand Down
Loading