Skip to content

Commit

Permalink
Address @maumar review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Jun 28, 2019
1 parent b1e245f commit 1abdfbf
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -876,11 +876,11 @@ private Expression ProcessSetOperation(MethodCallExpression methodCallExpression

// Extract the includes from each side and compare to make sure they're identical.
// We don't allow set operations over operands with different includes.
var pendingIncludeFindingVisitor = new PendingIncludeFindingVisitor(false);
var pendingIncludeFindingVisitor = new PendingIncludeFindingVisitor(skipCollectionNavigations: false);
pendingIncludeFindingVisitor.Visit(preProcessResult1.state.PendingSelector.Body);
var pendingIncludes1 = pendingIncludeFindingVisitor.PendingIncludes;

pendingIncludeFindingVisitor = new PendingIncludeFindingVisitor(false);
pendingIncludeFindingVisitor = new PendingIncludeFindingVisitor(skipCollectionNavigations: false);
pendingIncludeFindingVisitor.Visit(preProcessResult2.state.PendingSelector.Body);
var pendingIncludes2 = pendingIncludeFindingVisitor.PendingIncludes;

Expand All @@ -891,14 +891,8 @@ private Expression ProcessSetOperation(MethodCallExpression methodCallExpression

foreach (var (i1, i2) in pendingIncludes1.Zip(pendingIncludes2, (i1, i2) => (i1, i2)))
{
if (i1.SourceMapping.RootEntityType != i2.SourceMapping.RootEntityType)
{
throw new NotSupportedException(CoreStrings.SetOperationWithDifferentIncludesInOperands);
}

if (i1.NavTreeNode.Flatten()
.Zip(i2.NavTreeNode.Flatten(), (n1, n2) => (First: n1, Second: n2))
.Any(nodes => nodes.First.Navigation != nodes.Second.Navigation))
if (i1.SourceMapping.RootEntityType != i2.SourceMapping.RootEntityType
|| i1.NavTreeNode.Navigation != i2.NavTreeNode.Navigation)
{
throw new NotSupportedException(CoreStrings.SetOperationWithDifferentIncludesInOperands);
}
Expand Down

0 comments on commit 1abdfbf

Please sign in to comment.