Exemplo n.º 1
0
        protected virtual Expression VisitIn(DbInExpression inExp)
        {
            var expr   = this.Visit(inExp.Expression);
            var select = this.Visit(inExp.Select) as DbSelectExpression;
            var values = this.VisitExpressionList(inExp.Values);

            return(this.UpdateIn(inExp, expr, select, values));
        }
 protected virtual bool CompareIn(DbInExpression a, DbInExpression b)
 {
     return
         (
         this.Compare(a.Expression, b.Expression) &&
         this.Compare(a.Select, b.Select) &&
         this.CompareExpressionList(a.Values, b.Values)
         );
 }
Exemplo n.º 3
0
        protected DbInExpression UpdateIn(DbInExpression inExp, Expression expression, DbSelectExpression select, IEnumerable <Expression> values)
        {
            if (expression != inExp.Expression || select != inExp.Select || values != inExp.Values)
            {
                if (select != null)
                {
                    return(new DbInExpression(expression, select));
                }
                else
                {
                    return(new DbInExpression(expression, values));
                }
            }

            return(inExp);
        }
Exemplo n.º 4
0
        protected override Expression VisitIn(DbInExpression inExp)
        {
            if (inExp.Values != null)
            {
                if (inExp.Values.Count == 0)
                {
                    this.Write("0 <> 0");
                }
                else
                {
                    this.VisitValue(inExp.Expression);
                    this.Write(" IN (");

                    for (int i = 0, n = inExp.Values.Count; i < n; i++)
                    {
                        if (i > 0)
                        {
                            this.Write(", ");
                        }

                        this.VisitValue(inExp.Values[i]);
                    }

                    this.Write(")");
                }
            }
            else
            {
                this.VisitValue(inExp.Expression);
                this.Write(" IN (");
                this.WriteLine(Indentation.Inner);
                this.Visit(inExp.Select);
                this.WriteLine(Indentation.Same);
                this.Write(")");
                this.Indent(Indentation.Outer);
            }

            return(inExp);
        }