Exemplo n.º 1
0
        private Expression FindSimilarRight(JoinExpression join, JoinExpression compareTo)
        {
            if (join == null)
            {
                return(null);
            }
            if (join.Join == compareTo.Join)
            {
                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, TableAlias.Comparer);
                    scope.Add(((AliasedExpression)join.Right).Alias, ((AliasedExpression)compareTo.Right).Alias);
                    if (DbExpressionComparer.AreEqual(null, scope, join.Condition, compareTo.Condition))
                    {
                        return(join.Right);
                    }
                }
            }
            Expression result = FindSimilarRight(join.Left as JoinExpression, compareTo);

            if (result == null)
            {
                result = FindSimilarRight(join.Right as JoinExpression, compareTo);
            }
            return(result);
        }
Exemplo n.º 2
0
 public bool Equals(HashedExpression other)
 {
     return(this.hashCode == other.hashCode &&
            DbExpressionComparer.AreEqual(this.expression, other.expression));
 }