private Expression FindSimilarRight(JoinExpression join, JoinExpression compareTo)
        {
            if (join == null)
            {
                return(null);
            }

            if (join.JoinType == compareTo.JoinType)
            {
                if (join.Right.NodeType == compareTo.Right.NodeType &&
                    DbExpressionComparer.AreEqual(join.Right, compareTo.Right))
                {
                    if (join.Condition == compareTo.Condition)
                    {
                        return(join.Right);
                    }

                    var scope = new ScopedDictionary <TableAlias, TableAlias>(null);
                    scope.Add(((AliasedExpression)join.Right).Alias, ((AliasedExpression)compareTo.Right).Alias);

                    if (DbExpressionComparer.AreEqual(null, scope, join.Condition, compareTo.Condition))
                    {
                        return(join.Right);
                    }
                }
            }

            return(FindSimilarRight(join.Left as JoinExpression, compareTo) ??
                   FindSimilarRight(join.Right as JoinExpression, compareTo));
        }
示例#2
0
 public bool Equals(HashedExpression other)
 {
     return(this.hashCode == other.hashCode &&
            DbExpressionComparer.AreEqual(this.expression, other.expression));
 }