internal SetOperatorExpression(SetOperator @operator, SourceWithAliasExpression left, SourceWithAliasExpression right, Alias alias) : base(DbExpressionType.SetOperator, alias) { this.Operator = @operator; this.Left = Validate(left, nameof(left)); this.Right = Validate(right, nameof(right)); }
public InsertSelectExpression(ITable table, bool useHistoryTable, SourceWithAliasExpression source, IEnumerable <ColumnAssignment> assigments) : base(DbExpressionType.InsertSelect) { this.Table = table; this.UseHistoryTable = useHistoryTable; this.Assigments = assigments.ToReadOnly(); this.Source = source; }
private SourceWithAliasExpression VisitSetOperatorPart(SourceWithAliasExpression part, List <ColumnExpression> askedColumns) { using (NewScope()) { CurrentScope.AddRange(askedColumns.ToDictionary(c => new ColumnExpression(c.Type, part.Alias, c.Name), c => (ColumnExpression?)null)); return((SourceWithAliasExpression)Visit(part)); } }
public DeleteExpression(ITable table, bool useHistoryTable, SourceWithAliasExpression source, Expression?where) : base(DbExpressionType.Delete) { this.Table = table; this.UseHistoryTable = useHistoryTable; this.Source = source; this.Where = where; }
public UpdateExpression(ITable table, bool useHistoryTable, SourceWithAliasExpression source, Expression where, IEnumerable <ColumnAssignment> assigments) : base(DbExpressionType.Update) { this.Table = table; this.UseHistoryTable = useHistoryTable; 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); }
static SourceWithAliasExpression Validate(SourceWithAliasExpression exp, string name) { if (exp == null) { throw new ArgumentNullException(name); } if (exp is TableExpression || exp is SqlTableValuedFunctionExpression) { throw new ArgumentException($"{name} should not be a {exp.GetType().Name}"); } return(exp); }
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); }
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); } }
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".Formato(source.NiceToString())); }