示例#1
0
        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}");
            }
        }
示例#2
0
 public SqlAggregateExpression(Type type, SqlAggregateType aggType, Expression argument, bool isDistinct)
     : base(type)
 {
     this.AggregateType = aggType;
     this.Argument = argument;
     this.IsDistinct = isDistinct;
 }
 public SqlAggregateExpression(Type type, SqlAggregateType aggType, Expression argument, bool isDistinct)
     : base(type)
 {
     this.AggregateType = aggType;
     this.Argument      = argument;
     this.IsDistinct    = isDistinct;
 }
示例#4
0
 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;
 }
示例#5
0
        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;
        }
示例#6
0
            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;
 }
示例#8
0
 protected virtual bool RequiresAsteriskWhenNoArgument(SqlAggregateType aggregateType)
 {
     return(aggregateType == SqlAggregateType.Count || aggregateType == SqlAggregateType.LongCount);
 }
示例#9
0
        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);
        }
示例#10
0
 protected virtual bool RequiresAsteriskWhenNoArgument(SqlAggregateType aggregateType)
 {
     return aggregateType == SqlAggregateType.Count || aggregateType == SqlAggregateType.LongCount;
 }
示例#11
0
 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}");
     }
 }
示例#12
0
 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;
 }