public AggregateSubqueryExpression(TableAlias groupByAlias, Expression aggregateInGroupSelect, ScalarExpression aggregateAsSubquery) : base(DbExpressionType.AggregateSubquery, aggregateAsSubquery.Type) { this.aggregateInGroupSelect = aggregateInGroupSelect; this.groupByAlias = groupByAlias; this.aggregateAsSubquery = aggregateAsSubquery; }
protected virtual Expression VisitScalar(ScalarExpression scalar) { SelectExpression select = (SelectExpression)this.Visit(scalar.Select); if (select != scalar.Select) { return(new ScalarExpression(scalar.Type, select)); } return(scalar); }
protected virtual Expression VisitAggregateSubquery(AggregateSubqueryExpression aggregate) { Expression e = this.Visit(aggregate.AggregateAsSubquery); System.Diagnostics.Debug.Assert(e is ScalarExpression); ScalarExpression subquery = (ScalarExpression)e; if (subquery != aggregate.AggregateAsSubquery) { return(new AggregateSubqueryExpression(aggregate.GroupByAlias, aggregate.AggregateInGroupSelect, subquery)); } return(aggregate); }
protected virtual bool CompareScalar(ScalarExpression a, ScalarExpression b) { return(Compare(a.Select, b.Select)); }