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"); }
public InsertSelectExpression(ITable table, SourceWithAliasExpression source, IEnumerable <ColumnAssignment> assigments) : base(DbExpressionType.InsertSelect) { this.Table = table; this.Assigments = assigments.ToReadOnly(); this.Source = source; }
public DeleteExpression(ITable table, SourceWithAliasExpression source, Expression where) : base(DbExpressionType.Delete) { this.Table = table; this.Source = source; this.Where = where; }
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)); } }
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; }
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); }
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); }
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); }
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())); } }