protected internal override Expression VisitAggregate(AggregateExpression aggregate) { Expression source = MakeSqlValue(Visit(aggregate.Expression)); if (source != aggregate.Expression) { return(new AggregateExpression(aggregate.Type, source, aggregate.AggregateFunction, aggregate.Distinct)); } return(aggregate); }
protected internal virtual Expression VisitAggregate(AggregateExpression aggregate) { Expression source = Visit(aggregate.Expression); if (source != aggregate.Expression) { return(new AggregateExpression(aggregate.Type, source, aggregate.AggregateFunction, aggregate.Distinct)); } return(aggregate); }
protected internal virtual Expression VisitAggregate(AggregateExpression aggregate) { var expressions = Visit(aggregate.Arguments); if (expressions != aggregate.Arguments) { return(new AggregateExpression(aggregate.Type, aggregate.AggregateFunction, expressions)); } return(aggregate); }
protected internal override Expression VisitAggregate(AggregateExpression aggregate) { var saveInAggregate = this.inAggregate; this.inAggregate = true; var result = base.VisitAggregate(aggregate); this.inAggregate = saveInAggregate; return(result); }
protected internal override Expression VisitAggregate(AggregateExpression aggregate) { sb.Append(dic[aggregate.AggregateFunction]); sb.Append("("); if (aggregate.Expression == null) { sb.Append("*"); } else { Visit(aggregate.Expression); } sb.Append(")"); return(aggregate); }
private bool IsCountSumOrAvg(SelectExpression select) { ColumnDeclaration col = select.Columns.Only(); if (col == null) { return(false); } Expression exp = col.Expression; if (exp is IsNullExpression) { exp = ((IsNullExpression)exp).Expression; } if (exp.NodeType == ExpressionType.Coalesce) { var be = ((BinaryExpression)exp); if (be.Right.NodeType == ExpressionType.Constant || be.Right is SqlConstantExpression) { exp = ((BinaryExpression)exp).Left; } } AggregateExpression aggExp = exp as AggregateExpression; if (aggExp == null) { return(false); } return(aggExp.AggregateFunction == AggregateSqlFunction.Count || aggExp.AggregateFunction == AggregateSqlFunction.Sum || aggExp.AggregateFunction == AggregateSqlFunction.Average || aggExp.AggregateFunction == AggregateSqlFunction.StdDev || aggExp.AggregateFunction == AggregateSqlFunction.StdDevP); }
public AggregateRequestsExpression(Alias groupByAlias, AggregateExpression aggregate) : base(DbExpressionType.AggregateRequest, aggregate.Type) { this.Aggregate = aggregate; this.GroupByAlias = groupByAlias; }
protected virtual bool CompareAggregate(AggregateExpression a, AggregateExpression b) { return(a.AggregateFunction == b.AggregateFunction && CompareList(a.Arguments, b.Arguments, Compare)); }
protected internal override Expression VisitAggregate(AggregateExpression aggregate) { this.hasAggregate = true; return(aggregate); }
protected internal override Expression VisitAggregate(AggregateExpression aggregate) { hasAggregates = true; return(base.VisitAggregate(aggregate)); }
protected virtual bool CompareAggregate(AggregateExpression a, AggregateExpression b) { return(a.AggregateFunction == b.AggregateFunction && Compare(a.Expression, b.Expression)); }