예제 #1
0
 internal SetOperatorExpression(SetOperator @operator, SourceWithAliasExpression left, SourceWithAliasExpression right, Alias alias)
     : base(DbExpressionType.SetOperator, alias)
 {
     this.Operator = @operator;
     this.Left     = left ?? throw new ArgumentNullException("left");
     this.Right    = right ?? throw new ArgumentNullException("right");
 }
예제 #2
0
 public InsertSelectExpression(ITable table, SourceWithAliasExpression source, IEnumerable <ColumnAssignment> assigments)
     : base(DbExpressionType.InsertSelect)
 {
     this.Table      = table;
     this.Assigments = assigments.ToReadOnly();
     this.Source     = source;
 }
예제 #3
0
 public DeleteExpression(ITable table, SourceWithAliasExpression source, Expression where)
     : base(DbExpressionType.Delete)
 {
     this.Table  = table;
     this.Source = source;
     this.Where  = where;
 }
예제 #4
0
 private SourceWithAliasExpression VisitSetOperatorPart(SourceWithAliasExpression part, List <ColumnExpression> askedColumns)
 {
     using (NewScope())
     {
         CurrentScope.AddRange(askedColumns.ToDictionary(c => new ColumnExpression(c.Type, part.Alias, c.Name), c => (Expression)null));
         return((SourceWithAliasExpression)Visit(part));
     }
 }
예제 #5
0
 public UpdateExpression(ITable table, SourceWithAliasExpression source, Expression where, IEnumerable <ColumnAssignment> assigments)
     : base(DbExpressionType.Update)
 {
     this.Table      = table;
     this.Assigments = assigments.ToReadOnly();
     this.Source     = source;
     this.Where      = where;
 }
예제 #6
0
        protected internal virtual Expression VisitSetOperator(SetOperatorExpression set)
        {
            SourceWithAliasExpression left  = (SourceWithAliasExpression)this.VisitSource(set.Left) !;
            SourceWithAliasExpression right = (SourceWithAliasExpression)this.VisitSource(set.Right) !;

            if (left != set.Left || right != set.Right)
            {
                return(new SetOperatorExpression(set.Operator, left, right, set.Alias));
            }
            return(set);
        }
예제 #7
0
        protected internal override Expression VisitSetOperator(SetOperatorExpression set)
        {
            SourceWithAliasExpression left  = (SourceWithAliasExpression)this.VisitSource(set.Left) !;
            SourceWithAliasExpression right = (SourceWithAliasExpression)this.VisitSource(set.Right) !;
            Alias newAlias = aliasMap.TryGetC(set.Alias) ?? set.Alias;

            if (left != set.Left || right != set.Right || newAlias != set.Alias)
            {
                return(new SetOperatorExpression(set.Operator, left, right, newAlias));
            }
            return(set);
        }
예제 #8
0
        protected internal override Expression VisitSetOperator(SetOperatorExpression set)
        {
            List <ColumnExpression> askedColumns = CurrentScope.Keys.Where(k => k.Alias == set.Alias).ToList();

            SourceWithAliasExpression left  = VisitSetOperatorPart(set.Left, askedColumns);
            SourceWithAliasExpression right = VisitSetOperatorPart(set.Right, askedColumns);

            CurrentScope.SetRange(askedColumns, askedColumns);

            if (left != set.Left || right != set.Right)
            {
                return(new SetOperatorExpression(set.Operator, left, right, set.Alias));
            }

            return(set);
        }
예제 #9
0
 void VisitSetPart(SourceWithAliasExpression source)
 {
     if (source is SelectExpression)
     {
         this.Indent(Indentation.Inner);
         VisitSelect((SelectExpression)source);
         this.Indent(Indentation.Outer);
     }
     else if (source is SetOperatorExpression)
     {
         VisitSetOperator((SetOperatorExpression)source);
     }
     else
     {
         throw new InvalidOperationException("{0} not expected in SetOperatorExpression".FormatWith(source.ToString()));
     }
 }