From 65294edebc7a460af54b84204c9c068f241106bb Mon Sep 17 00:00:00 2001 From: David Lebee Date: Thu, 5 Apr 2018 19:40:33 -0500 Subject: [PATCH] null type resolving. --- PoweredSoft.DynamicLinq.ConsoleApp/BetterProto2.cs | 2 ++ PoweredSoft.DynamicLinq/Parser/ParserExtensions.cs | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/PoweredSoft.DynamicLinq.ConsoleApp/BetterProto2.cs b/PoweredSoft.DynamicLinq.ConsoleApp/BetterProto2.cs index 1b51da4..c5cd3fc 100644 --- a/PoweredSoft.DynamicLinq.ConsoleApp/BetterProto2.cs +++ b/PoweredSoft.DynamicLinq.ConsoleApp/BetterProto2.cs @@ -97,6 +97,8 @@ namespace PoweredSoft.DynamicLinq.ConsoleApp // group the piece by common parameters var groups = Parser.GroupBySharedParameters(); + var nullType = groups.ResolveNullHandlingType(); + Expression currentExpression = null; groups.ReversedForEach(group => { diff --git a/PoweredSoft.DynamicLinq/Parser/ParserExtensions.cs b/PoweredSoft.DynamicLinq/Parser/ParserExtensions.cs index 5fdb7ac..e212aca 100644 --- a/PoweredSoft.DynamicLinq/Parser/ParserExtensions.cs +++ b/PoweredSoft.DynamicLinq/Parser/ParserExtensions.cs @@ -28,5 +28,16 @@ namespace PoweredSoft.DynamicLinq.Parser { return group.Pieces.Last().EnumerableType; } + + public static Type ResolveNullHandlingType(this List groups) + { + if (groups.Count() == 1) + { + throw new NotImplementedException(); + } + + var type = groups.Last().Pieces.Last().Type; + return typeof(IEnumerable<>).MakeGenericType(type); + } } }