Exemplo n.º 1
0
 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);
        }
Exemplo n.º 4
0
 protected virtual bool CompareScalar(ScalarExpression a, ScalarExpression b)
 {
     return(Compare(a.Select, b.Select));
 }