/// <summary> /// /// </summary> /// <param name="groupByAlias"></param> /// <param name="aggregateInGroupSelect"></param> /// <param name="aggregateAsSubquery"></param> public AggregateSubqueryExpression(TableAlias groupByAlias, Expression aggregateInGroupSelect, ScalarExpression aggregateAsSubquery) : base(DbExpressionType.AggregateSubquery, aggregateAsSubquery.Type) { this.aggregateInGroupSelect = aggregateInGroupSelect; this.groupByAlias = groupByAlias; this.aggregateAsSubquery = aggregateAsSubquery; }
/// <summary> /// /// </summary> /// <param name="scalar"></param> /// <returns></returns> 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); }
/// <summary> /// /// </summary> /// <param name="aggregate"></param> /// <returns></returns> 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); }
/// <summary> /// /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> protected virtual bool CompareScalar(ScalarExpression a, ScalarExpression b) { return(this.Compare(a.Select, b.Select)); }