From 436bd5ab98b5b4de5651c892b9bd8e019e08ad1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Leb=C3=A9e?= Date: Mon, 12 Mar 2018 22:01:41 -0500 Subject: [PATCH] select builder started. --- PoweredSoft.DynamicLinq.Test/GroupingTests.cs | 4 ++-- .../Extensions/EnumerableExtensions.cs | 13 +++++++++++++ .../Fluent/Select/SelectBuilder.cs | 11 +++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 PoweredSoft.DynamicLinq/Fluent/Select/SelectBuilder.cs diff --git a/PoweredSoft.DynamicLinq.Test/GroupingTests.cs b/PoweredSoft.DynamicLinq.Test/GroupingTests.cs index 54d5e01..0681f95 100644 --- a/PoweredSoft.DynamicLinq.Test/GroupingTests.cs +++ b/PoweredSoft.DynamicLinq.Test/GroupingTests.cs @@ -84,7 +84,7 @@ namespace PoweredSoft.DynamicLinq.Test Sales = t.ToList() });*/ - /* + .Select(t => { t.PropertyFromKey("TheClientId", "ClientId"); @@ -95,7 +95,7 @@ namespace PoweredSoft.DynamicLinq.Test t.Sum("NetSales"); t.Average("TaxAverage", "Tax"); t.ToList("Sales"); - });*/ + }); } private object compare(MockSale arg) diff --git a/PoweredSoft.DynamicLinq/Extensions/EnumerableExtensions.cs b/PoweredSoft.DynamicLinq/Extensions/EnumerableExtensions.cs index 5312623..29cd9c6 100644 --- a/PoweredSoft.DynamicLinq/Extensions/EnumerableExtensions.cs +++ b/PoweredSoft.DynamicLinq/Extensions/EnumerableExtensions.cs @@ -1,5 +1,6 @@ using PoweredSoft.DynamicLinq.Fluent; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -33,5 +34,17 @@ namespace PoweredSoft.DynamicLinq public static IEnumerable ThenByDescending(this IEnumerable list, string path) => list.AsQueryable().ThenByDescending(path); + + public static IQueryable GroupBy(this IEnumerable list, string path) + => list.AsQueryable().GroupBy(typeof(T), path); + + public static IQueryable GroupBy(this IEnumerable list, Type type, string path) + => list.AsQueryable().GroupBy(type, path); + + public static IQueryable GroupBy(this IEnumerable list, Action callback) + => list.AsQueryable().GroupBy(typeof(T), callback); + + public static IQueryable GroupBy(this IEnumerable list, Type type, Action callback) + => list.AsQueryable().GroupBy(type, callback); } } diff --git a/PoweredSoft.DynamicLinq/Fluent/Select/SelectBuilder.cs b/PoweredSoft.DynamicLinq/Fluent/Select/SelectBuilder.cs new file mode 100644 index 0000000..29f4b36 --- /dev/null +++ b/PoweredSoft.DynamicLinq/Fluent/Select/SelectBuilder.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace PoweredSoft.DynamicLinq.Fluent +{ + public class SelectBuilder + { + + } +}