Description
Provide a way to express multiple aggregates in LINQ like we do in SQL:
SELECT MIN(salary), MAX(salary) from Employee,
LINQ to SQL and EntityFramework allow constructs like these:
[Test] public void TestAggregatesMultiple() { var ints = GetPersonCache().AsCacheQueryable().Select(x => x.Key); var res = ints.GroupBy(x => 1).Select(g => new {Sum = g.Sum(), Avg = g.Average()}).Single(); Assert.AreEqual(ints.Sum(), res.Sum); Assert.AreEqual(ints.Average(), res.Avg); var res2 = ints.Select(x => new {Sum = ints.Sum(), Avg = ints.Average()}).First(); Assert.AreEqual(ints.Sum(), res2.Sum); Assert.AreEqual(ints.Average(), res2.Avg); }