diff --git a/PoweredSoft.DynamicLinq.Test/GroupingTests.cs b/PoweredSoft.DynamicLinq.Test/GroupingTests.cs index 04fa6c8..558d56c 100644 --- a/PoweredSoft.DynamicLinq.Test/GroupingTests.cs +++ b/PoweredSoft.DynamicLinq.Test/GroupingTests.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using PoweredSoft.DynamicLinq; using PoweredSoft.DynamicLinq.Dal; +using System.Diagnostics; namespace PoweredSoft.DynamicLinq.Test { @@ -83,13 +84,14 @@ namespace PoweredSoft.DynamicLinq.Test Count = t.Count(), });*/ + /* TestData.Sales.GroupBy(t => new { t.ClientId }).Select(t => new { TheClientId = t.Key.ClientId, Count = t.Count(), LongCount = t.LongCount(), TaxAverage = t.Average(t2 => t2.Tax) - }); + });*/ var dynamicSyntax2 = TestData.Sales .AsQueryable() @@ -101,9 +103,10 @@ namespace PoweredSoft.DynamicLinq.Test t.LongCount("LongCount"); t.Sum("NetSales"); t.Average("Tax", "TaxAverage"); - //t.ToList("Sales"); + t.ToList("Sales"); }); + var result = dynamicSyntax2.ToObjectList(); } } diff --git a/PoweredSoft.DynamicLinq/Helpers/QueryableHelpers.cs b/PoweredSoft.DynamicLinq/Helpers/QueryableHelpers.cs index e63ce35..b564851 100644 --- a/PoweredSoft.DynamicLinq/Helpers/QueryableHelpers.cs +++ b/PoweredSoft.DynamicLinq/Helpers/QueryableHelpers.cs @@ -181,6 +181,12 @@ namespace PoweredSoft.DynamicLinq.Helpers var body = Expression.Call(typeof(Enumerable), "Sum", new[] { notGroupedType }, parameter, innerMemberLambda); return body; } + else if (selectType == SelectTypes.ToList) + { + var notGroupedType = parameter.Type.GenericTypeArguments[1]; + var body = Expression.Call(typeof(Enumerable), "ToList", new[] { notGroupedType }, parameter); + return body; + } throw new NotSupportedException($"unkown select type {selectType}"); }