public static MaxGroupAggregateQuery <TKey, TRecord, TExpressionValue> Max <TKey, TRecord, TExpressionValue>( this IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TExpressionValue> > field = null ) { return(new MaxGroupAggregateQuery <TKey, TRecord, TExpressionValue>(groupingQuery, field)); }
public static AvgGroupAggregateQuery <TKey, TRecord, TAvgType> Avg <TKey, TRecord, TAvgType>( this IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TAvgType> > field = null ) { return(new AvgGroupAggregateQuery <TKey, TRecord, TAvgType>(groupingQuery, field)); }
public static SumGroupAggregateQuery <TKey, TRecord, TSumType> Sum <TKey, TRecord, TSumType>( this IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TSumType> > field = null ) { return(new SumGroupAggregateQuery <TKey, TRecord, TSumType>(groupingQuery, field)); }
public static ContainsGroupAggregateQuery <TKey, TRecord> Contains <TKey, TRecord>( this IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, bool> > predicate = null ) { return(new ContainsGroupAggregateQuery <TKey, TRecord>(groupingQuery, predicate)); }
public static void GroupQuery() { IQuery <User> q = context.Query <User>(); IGroupingQuery <User> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age); g = g.Having(a => a.Age > 1 && Sql.Count() > 0); g.Select(a => new { a.Age, Count = Sql.Count(), Sum = Sql.Sum(a.Age), Max = Sql.Max(a.Age), Min = Sql.Min(a.Age), Avg = Sql.Average(a.Age) }).ToList(); /* * */ ConsoleHelper.WriteLineAndReadKey(); }
public virtual void GroupQuery() { IQuery <Person> q = this.DbContext.Query <Person>(); IGroupingQuery <Person> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age); g = g.Having(a => true); g.Select(a => new { a.Age, Count = Sql.Count(), Sum = Sql.Sum(a.Age), Max = Sql.Max(a.Age), Min = Sql.Min(a.Age), Avg = Sql.Average(a.Age) }).ToList(); /* * SELECT [Person].[Age] AS [Age],COUNT(1) AS [Count],CAST(SUM([Person].[Age]) AS INTEGER) AS [Sum],CAST(MAX([Person].[Age]) AS INTEGER) AS [Max],CAST(MIN([Person].[Age]) AS INTEGER) AS [Min],CAST(AVG([Person].[Age]) AS REAL) AS [Avg] FROM [Person] AS [Person] WHERE [Person].[Id] > 0 GROUP BY [Person].[Age] HAVING ([Person].[Age] > 1 AND COUNT(1) > 0) */ ConsoleHelper.WriteLineAndReadKey(); }
public static void GroupQuery() { IQuery <User> q = context.Query <User>(); IGroupingQuery <User> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age); g = g.Having(a => a.Age > 1 && AggregateFunctions.Count() > 0); g.Select(a => new { a.Age, Count = AggregateFunctions.Count(), Sum = AggregateFunctions.Sum(a.Age), Max = AggregateFunctions.Max(a.Age), Min = AggregateFunctions.Min(a.Age), Avg = AggregateFunctions.Average(a.Age) }).ToList(); /* * SELECT [Users].[Age] AS [Age],COUNT(1) AS [Count],CAST(SUM([Users].[Age]) AS INT) AS [Sum],MAX([Users].[Age]) AS [Max],MIN([Users].[Age]) AS [Min],CAST(AVG([Users].[Age]) AS FLOAT) AS [Avg] FROM [Users] AS [Users] WHERE [Users].[Id] > 0 GROUP BY [Users].[Age] HAVING ([Users].[Age] > 1 AND COUNT(1) > 0) */ ConsoleHelper.WriteLineAndReadKey(); }
public static void GroupQuery() { IQuery <User> q = context.Query <User>(); IGroupingQuery <User> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age); g = g.Having(a => a.Age > 1 && AggregateFunctions.Count() > 0); g.Select(a => new { a.Age, Count = AggregateFunctions.Count(), Sum = AggregateFunctions.Sum(a.Age), Max = AggregateFunctions.Max(a.Age), Min = AggregateFunctions.Min(a.Age), Avg = AggregateFunctions.Average(a.Age) }).ToList(); /* * SELECT "USERS"."AGE" AS "AGE",COUNT(1) AS "COUNT",SUM("USERS"."AGE") AS "SUM",MAX("USERS"."AGE") AS "MAX",MIN("USERS"."AGE") AS "MIN",AVG("USERS"."AGE") AS "AVG" FROM "USERS" "USERS" WHERE "USERS"."ID" > 0 GROUP BY "USERS"."AGE" HAVING ("USERS"."AGE" > 1 AND COUNT(1) > 0) */ ConsoleHelper.WriteLineAndReadKey(); }
public static void GQTest() { MsSqlContext context = new MsSqlContext(DbHelper.ConnectionString); IQuery <User> q = context.Query <User>(); IGroupingQuery <User> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age); g = g.Having(a => a.Age > 1 && Sql.Count() > 0); g.Select(a => new { a.Age, Count = Sql.Count(), Sum = Sql.Sum(a.Age), Max = Sql.Max(a.Age), Min = Sql.Min(a.Age), Avg = Sql.Average(a.Age) }).ToList(); /* * SELECT [Users].[Age] AS [Age],COUNT(1) AS [Count],SUM([Users].[Age]) AS [Sum],MAX([Users].[Age]) AS [Max],MIN([Users].[Age]) AS [Min],CAST(AVG([Users].[Age]) AS FLOAT) AS [Avg] FROM [Users] AS [Users] WHERE [Users].[Id] > 0 GROUP BY [Users].[Age] HAVING ([Users].[Age] > 1 AND COUNT(1) > 0) */ }
public static void GroupQuery() { IQuery <User> q = context.Query <User>(); IGroupingQuery <User> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age); g = g.Having(a => a.Age > 1 && AggregateFunctions.Count() > 0); g.Select(a => new { a.Age, Count = AggregateFunctions.Count(), Sum = AggregateFunctions.Sum(a.Age), Max = AggregateFunctions.Max(a.Age), Min = AggregateFunctions.Min(a.Age), Avg = AggregateFunctions.Average(a.Age) }).ToList(); /* * SELECT `Users`.`Age` AS `Age`,COUNT(1) AS `Count`,CAST(SUM(`Users`.`Age`) AS SIGNED) AS `Sum`,MAX(`Users`.`Age`) AS `Max`,MIN(`Users`.`Age`) AS `Min`,AVG(`Users`.`Age`) AS `Avg` FROM `Users` AS `Users` WHERE `Users`.`Id` > 0 GROUP BY `Users`.`Age` HAVING (`Users`.`Age` > 1 AND COUNT(1) > 0) */ ConsoleHelper.WriteLineAndReadKey(); }
public CountGroupAggregateQuery(IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, bool> > predicate) { this.groupingQuery = groupingQuery; this.predicate = predicate; }
public MapGroupQuery(IGroupingQuery <TKey, TOriginal[]> groupingQuery, Expression <Func <TOriginal, TTarget> > mapExpression) { this.groupingQuery = groupingQuery; this.mapExpression = mapExpression; }
public MinGroupAggregateQuery(IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TExpressionValue> > field) { this.groupingQuery = groupingQuery; this.field = field; }
public ReduceGroupQuery(IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TRecord, TRecord> > reduceFunction) { this.groupingQuery = groupingQuery; this.reduceFunction = reduceFunction; }
public static ReduceGroupQuery <TKey, TRecord> Reduce <TKey, TRecord>( this IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TRecord, TRecord> > reduceFunction) { return(new ReduceGroupQuery <TKey, TRecord>(groupingQuery, reduceFunction)); }
public static MapGroupQuery <TKey, TOriginal, TTarget> Map <TKey, TOriginal, TTarget>( this IGroupingQuery <TKey, TOriginal[]> groupingQuery, Expression <Func <TOriginal, TTarget> > mapExpression) { return(new MapGroupQuery <TKey, TOriginal, TTarget>(groupingQuery, mapExpression)); }
public static UngroupQuery <TKey, TValue, TResult> Ungroup <TKey, TValue, TResult>(this IGroupingQuery <TKey, TValue> groupingQuery) { return(new UngroupQuery <TKey, TValue, TResult>(groupingQuery)); }
public static UngroupQuery <TKey, TValue, UngroupObject <TKey, TValue> > Ungroup <TKey, TValue>(this IGroupingQuery <TKey, TValue> groupingQuery) { return(new UngroupQuery <TKey, TValue, UngroupObject <TKey, TValue> >(groupingQuery)); }
public SumGroupAggregateQuery(IGroupingQuery <TKey, TRecord[]> groupingQuery, Expression <Func <TRecord, TSumType> > field) { this.groupingQuery = groupingQuery; this.field = field; }
public UngroupQuery(IGroupingQuery <TKey, TValue> groupingQuery) { this.groupingQuery = groupingQuery; }