private static string GetAggregateName(SqlAggregateType aggregateType) { switch (aggregateType) { case SqlAggregateType.Count: return("COUNT"); case SqlAggregateType.LongCount: return("COUNT"); case SqlAggregateType.Min: return("MIN"); case SqlAggregateType.Max: return("MAX"); case SqlAggregateType.Sum: return("SUM"); case SqlAggregateType.Average: return("AVG"); default: throw new NotSupportedException($"Unknown aggregate type: {aggregateType}"); } }
public SqlAggregateExpression(Type type, SqlAggregateType aggType, Expression argument, bool isDistinct) : base(type) { this.AggregateType = aggType; this.Argument = argument; this.IsDistinct = isDistinct; }
public PrivateExecuteResult(IEnumerable <T> results, SelectFirstType selectFirstType, SqlAggregateType sqlAggregateType, bool defaultIfEmpty, Expression defaultValueExpression) : this() { this.results = results; this.sqlAggregateType = sqlAggregateType; this.selectFirstType = selectFirstType; this.defaultIfEmpty = defaultIfEmpty; this.defaultValueExpression = defaultValueExpression; }
protected static SqlAggregateExpression UpdateAggregate(SqlAggregateExpression sqlAggregate, Type type, SqlAggregateType aggType, Expression arg, bool isDistinct) { if (type != sqlAggregate.Type || aggType != sqlAggregate.AggregateType || arg != sqlAggregate.Argument || isDistinct != sqlAggregate.IsDistinct) { return new SqlAggregateExpression(type, aggType, arg, isDistinct); } return sqlAggregate; }
public virtual string GetAggregateOperator(SqlAggregateType aggr) { switch (aggr) { case SqlAggregateType.Avg: return("AVG"); case SqlAggregateType.Count: return("COUNT"); case SqlAggregateType.Max: return("MAX"); case SqlAggregateType.Min: return("MIN"); case SqlAggregateType.StdDev: return("STDDEV"); case SqlAggregateType.Sum: return("SUM"); } return(String.Empty); }
public virtual string GetAggregateOperator(SqlAggregateType aggr) { switch (aggr) { case SqlAggregateType.Avg: return "AVG"; case SqlAggregateType.Count: return "COUNT"; case SqlAggregateType.Max: return "MAX"; case SqlAggregateType.Min: return "MIN"; case SqlAggregateType.StdDev: return "STDDEV"; case SqlAggregateType.Sum: return "SUM"; } return String.Empty; }
protected virtual bool RequiresAsteriskWhenNoArgument(SqlAggregateType aggregateType) { return(aggregateType == SqlAggregateType.Count || aggregateType == SqlAggregateType.LongCount); }
protected static SqlAggregateExpression UpdateAggregate(SqlAggregateExpression sqlAggregate, Type type, SqlAggregateType aggType, Expression arg, bool isDistinct) { if (type != sqlAggregate.Type || aggType != sqlAggregate.AggregateType || arg != sqlAggregate.Argument || isDistinct != sqlAggregate.IsDistinct) { return(new SqlAggregateExpression(type, aggType, arg, isDistinct)); } return(sqlAggregate); }
protected virtual bool RequiresAsteriskWhenNoArgument(SqlAggregateType aggregateType) { return aggregateType == SqlAggregateType.Count || aggregateType == SqlAggregateType.LongCount; }
private static string GetAggregateName(SqlAggregateType aggregateType) { switch (aggregateType) { case SqlAggregateType.Count: return "COUNT"; case SqlAggregateType.LongCount: return "COUNT"; case SqlAggregateType.Min: return "MIN"; case SqlAggregateType.Max: return "MAX"; case SqlAggregateType.Sum: return "SUM"; case SqlAggregateType.Average: return "AVG"; default: throw new NotSupportedException($"Unknown aggregate type: {aggregateType}"); } }
public static AggregateSqlExpression Aggregate(SqlAggregateType type, params SqlExpression[] parameters) { return(new AggregateSqlExpression(type, parameters)); }
public AggregateSqlExpression(SqlAggregateType type, params SqlExpression[] parameters) { Type = type; Parameters = parameters; }