Grouping in DA LINQ

I would like to give you a preview of the next release of DataAbstract for .NET, which will provide grouping support in DA LINQ (and in DA SQL as well).
You will be able to write queries like this:

A simple GROUP BY with an aggregate function Count:

var q = from x in DataModule.Instance.DataAdapter.GetTable() group x by x.Client into g select new { Client = g.Key, OrderCount = g.Count() };   return q.ToList();

This query will be translated into the followig DA SQL query:

SELECT[t0].[Client],COUNT(*)AS[agg1]FROM[Orders][t0]GROUPBY[t0].[Client]

The query in action:

A GROUP BY with other aggregate functions:

var q = from x in DataModule.Instance.DataAdapter.GetTable() group x by x.Provider into g select new { provID = g.Key, sumVal = g.Sum(x => x.Total), minVal = g.Min(x => x.Total), maxVal = g.Max(x => x.Total), avgVal = g.Average(x => x.Total) };   return q.ToList();

This query will be translated into:

SELECT[t0].[Provider],SUM([t0].[Total])AS[agg1],MIN([t0].[Total])AS[agg2],MAX([t0].[Total])AS[agg3], Avg([t0].[Total])AS[agg4]FROM[OrderDetails][t0]GROUPBY[t0].[Provider]

The query in action:

A GROUP BY on several fields:

var q = from x in DataModule.Instance.DataAdapter.GetTable() group x by new { x.Product, x.Provider } into g select new { prodID = g.Key.Product, provID = g.Key.Provider, sumVal = g.Sum(x => x.Total) };   return q.ToList();

The query will be translated into:

SELECT[t0].[Product]AS[prodID],[t0].[Provider]AS[provID],SUM([t0].[Total])AS[agg1]FROM[OrderDetails][t0]GROUPBY[t0].[Product],[t0].[Provider]

The query in action:

alexk

0