From a74b63533244d87824a546c1edda9c7023de0988 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 13 Oct 2019 13:05:27 -0500 Subject: [PATCH 1/6] 2.1.x change to be able to push updates for 2.0 branch. --- .../PoweredSoft.DynamicQuery.AspNetCore.csproj | 2 +- .../PoweredSoft.DynamicQuery.Core.csproj | 2 +- PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj b/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj index efb4056..105a3ce 100644 --- a/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj +++ b/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj @@ -8,7 +8,7 @@ https://github.com/PoweredSoft/DynamicQuery github powered,soft,dynamic,criteria,query,builder,asp,net,core - 2.0.0$(VersionSuffix) + 2.1.0$(VersionSuffix) https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&r=g&d=retro PoweredSoft.DynamicQuery.AspNetCore This projects makes it easier to use dynamic query in a asp.net core mvc project. diff --git a/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj b/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj index cc4ce77..88b58f3 100644 --- a/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj +++ b/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj @@ -8,7 +8,7 @@ https://github.com/PoweredSoft/DynamicQuery.Core/ github powered,soft,dynamic,criteria,query,builder - 2.0.0$(VersionSuffix) + 2.1.0$(VersionSuffix) https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&r=g&d=retro PoweredSoft.DynamicQuery.Core core abstractions diff --git a/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj b/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj index eb3f4f9..47315f0 100644 --- a/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj +++ b/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj @@ -8,7 +8,7 @@ https://github.com/PoweredSoft/DynamicQuery github powered,soft,dynamic,criteria,query,builder - 2.0.0$(VersionSuffix) + 2.1.0$(VersionSuffix) https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&r=g&d=retro PoweredSoft.DynamicQuery dynamic query based on string path very usefull for network requests. From c300906c5e3a0b00fe428bb1e80f955b92299c49 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 13 Oct 2019 14:06:47 -0500 Subject: [PATCH 2/6] not ready for ef core 3 yet but allowing aspnet core 3 --- DynamicQuery.sln | 12 +++++++++++ .../MvcBuilderExtensions.cs | 8 -------- ...PoweredSoft.DynamicQuery.AspNetCore.csproj | 10 +++++++--- .../PoweredSoft.DynamicQuery.Cli.csproj | 1 + .../ISimpleFilter.cs | 1 + .../PoweredSoft.DynamicQuery.Core.csproj | 4 ++++ .../DynamicQueryJsonConverter.cs | 0 .../Extensions.cs | 20 +++++++++++++++++++ ...redSoft.DynamicQuery.NewtonsoftJson.csproj | 15 ++++++++++++++ ...oweredSoft.DynamicQuery.System.Json.csproj | 11 ++++++++++ .../DeserializeTests.cs | 1 + PoweredSoft.DynamicQuery.Test/FilterTests.cs | 1 + .../Mock/MockContextFactory.cs | 8 +++++++- .../PoweredSoft.DynamicQuery.Test.csproj | 11 ++++++---- PoweredSoft.DynamicQuery/Filter.cs | 1 + .../PoweredSoft.DynamicQuery.csproj | 2 +- PoweredSoft.DynamicQuery/QueryHandlerBase.cs | 2 +- 17 files changed, 90 insertions(+), 18 deletions(-) rename {PoweredSoft.DynamicQuery.AspNetCore/Json => PoweredSoft.DynamicQuery.NewtonsoftJson}/DynamicQueryJsonConverter.cs (100%) create mode 100644 PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs create mode 100644 PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj create mode 100644 PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj diff --git a/DynamicQuery.sln b/DynamicQuery.sln index 58821d2..07e89e2 100644 --- a/DynamicQuery.sln +++ b/DynamicQuery.sln @@ -19,6 +19,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.Te EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.AspNetCore", "PoweredSoft.DynamicQuery.AspNetCore\PoweredSoft.DynamicQuery.AspNetCore.csproj", "{DF58BD18-AB47-4018-B1EA-D1118D93B408}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicQuery.System.Json", "PoweredSoft.DynamicQuery.System.Json\PoweredSoft.DynamicQuery.System.Json.csproj", "{9A196F3E-69F7-4D07-B635-451D3C94E8F9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicQuery.NewtonsoftJson", "PoweredSoft.DynamicQuery.NewtonsoftJson\PoweredSoft.DynamicQuery.NewtonsoftJson.csproj", "{201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +49,14 @@ Global {DF58BD18-AB47-4018-B1EA-D1118D93B408}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF58BD18-AB47-4018-B1EA-D1118D93B408}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF58BD18-AB47-4018-B1EA-D1118D93B408}.Release|Any CPU.Build.0 = Release|Any CPU + {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Release|Any CPU.Build.0 = Release|Any CPU + {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PoweredSoft.DynamicQuery.AspNetCore/MvcBuilderExtensions.cs b/PoweredSoft.DynamicQuery.AspNetCore/MvcBuilderExtensions.cs index 2308542..5a7c626 100644 --- a/PoweredSoft.DynamicQuery.AspNetCore/MvcBuilderExtensions.cs +++ b/PoweredSoft.DynamicQuery.AspNetCore/MvcBuilderExtensions.cs @@ -1,7 +1,5 @@ using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json.Converters; using PoweredSoft.Data; -using PoweredSoft.DynamicQuery.AspNetCore.Json; using System; using System.Collections.Generic; using System.Text; @@ -14,12 +12,6 @@ namespace PoweredSoft.DynamicQuery.AspNetCore { builder.Services.AddPoweredSoftDataServices(); builder.Services.AddPoweredSoftDynamicQuery(); - var serviceProvider = builder.Services.BuildServiceProvider(); - builder.AddJsonOptions(o => - { - o.SerializerSettings.Converters.Add(new StringEnumConverter()); - o.SerializerSettings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider)); - }); return builder; } } diff --git a/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj b/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj index 105a3ce..c3b8d3e 100644 --- a/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj +++ b/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.0 Powered Softwares Inc. MIT https://github.com/PoweredSoft/DynamicQuery @@ -19,8 +19,12 @@ - - + + + + + + diff --git a/PoweredSoft.DynamicQuery.Cli/PoweredSoft.DynamicQuery.Cli.csproj b/PoweredSoft.DynamicQuery.Cli/PoweredSoft.DynamicQuery.Cli.csproj index e702975..e22a13e 100644 --- a/PoweredSoft.DynamicQuery.Cli/PoweredSoft.DynamicQuery.Cli.csproj +++ b/PoweredSoft.DynamicQuery.Cli/PoweredSoft.DynamicQuery.Cli.csproj @@ -6,6 +6,7 @@ + diff --git a/PoweredSoft.DynamicQuery.Core/ISimpleFilter.cs b/PoweredSoft.DynamicQuery.Core/ISimpleFilter.cs index 26a7b1a..3baf1c5 100644 --- a/PoweredSoft.DynamicQuery.Core/ISimpleFilter.cs +++ b/PoweredSoft.DynamicQuery.Core/ISimpleFilter.cs @@ -4,5 +4,6 @@ { string Path { get; set; } object Value { get; set; } + bool? Not { get; set; } } } diff --git a/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj b/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj index 88b58f3..08f47fe 100644 --- a/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj +++ b/PoweredSoft.DynamicQuery.Core/PoweredSoft.DynamicQuery.Core.csproj @@ -18,4 +18,8 @@ David Lebee + + + + diff --git a/PoweredSoft.DynamicQuery.AspNetCore/Json/DynamicQueryJsonConverter.cs b/PoweredSoft.DynamicQuery.NewtonsoftJson/DynamicQueryJsonConverter.cs similarity index 100% rename from PoweredSoft.DynamicQuery.AspNetCore/Json/DynamicQueryJsonConverter.cs rename to PoweredSoft.DynamicQuery.NewtonsoftJson/DynamicQueryJsonConverter.cs diff --git a/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs b/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs new file mode 100644 index 0000000..37c055b --- /dev/null +++ b/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PoweredSoft.DynamicQuery.AspNetCore.Json; +using System; + +namespace PoweredSoft.DynamicQuery.NewtonsoftJson +{ + public static class JsonNetSerializationSettingsExtensions + { + public static JsonSerializerSettings AddPoweredSoftDynamicQueryNewtonsoftJson(this JsonSerializerSettings settings, IServiceProvider serviceProvider, bool enableStringEnumConverter = true) + { + if (enableStringEnumConverter) + settings.Converters.Add(new StringEnumConverter()); + + settings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider)); + return settings; + } + } +} diff --git a/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj b/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj new file mode 100644 index 0000000..63d0ffd --- /dev/null +++ b/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj b/PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj new file mode 100644 index 0000000..628e596 --- /dev/null +++ b/PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs b/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs index 2010116..2e8dfe4 100644 --- a/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs +++ b/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs @@ -22,6 +22,7 @@ namespace PoweredSoft.DynamicQuery.Test var serviceProvider = serviceCollection.BuildServiceProvider(); var settings = new JsonSerializerSettings(); + settings.Converters.Add(new StringEnumConverter()); settings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider)); diff --git a/PoweredSoft.DynamicQuery.Test/FilterTests.cs b/PoweredSoft.DynamicQuery.Test/FilterTests.cs index e085baa..0e1d0e7 100644 --- a/PoweredSoft.DynamicQuery.Test/FilterTests.cs +++ b/PoweredSoft.DynamicQuery.Test/FilterTests.cs @@ -17,6 +17,7 @@ namespace PoweredSoft.DynamicQuery.Test public FilterType Type { get; set; } = FilterType.Equal; public string Path { get; set; } = "FirstName"; public object Value { get; set; } = "Chuck"; + public bool? Not { get; set; } } [Fact] diff --git a/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs b/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs index 16765c9..7be51b0 100644 --- a/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs +++ b/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol; using Xunit.Sdk; @@ -12,7 +13,12 @@ namespace PoweredSoft.DynamicQuery.Test.Mock { public static void TestContextFor(string testName, Action action) { - var options = new DbContextOptionsBuilder().UseInMemoryDatabase(databaseName: testName).Options; + var options = new DbContextOptionsBuilder() + .ConfigureWarnings(warnings => + warnings.Ignore(RelationalEventId.QueryClientEvaluationWarning) + ) + .UseInMemoryDatabase(databaseName: testName).Options; + using (var ctx = new MockContext(options)) action(ctx); } diff --git a/PoweredSoft.DynamicQuery.Test/PoweredSoft.DynamicQuery.Test.csproj b/PoweredSoft.DynamicQuery.Test/PoweredSoft.DynamicQuery.Test.csproj index 0c28a1d..580c432 100644 --- a/PoweredSoft.DynamicQuery.Test/PoweredSoft.DynamicQuery.Test.csproj +++ b/PoweredSoft.DynamicQuery.Test/PoweredSoft.DynamicQuery.Test.csproj @@ -1,16 +1,18 @@ - + - netcoreapp2.1 + netcoreapp3.0 false - + - + + + @@ -21,6 +23,7 @@ + diff --git a/PoweredSoft.DynamicQuery/Filter.cs b/PoweredSoft.DynamicQuery/Filter.cs index 3b38b6b..4538e19 100644 --- a/PoweredSoft.DynamicQuery/Filter.cs +++ b/PoweredSoft.DynamicQuery/Filter.cs @@ -14,6 +14,7 @@ namespace PoweredSoft.DynamicQuery public class SimpleFilter : ISimpleFilter { public bool? And { get; set; } + public bool? Not { get; set; } public FilterType Type { get; set; } public string Path { get; set; } public object Value { get; set; } diff --git a/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj b/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj index 47315f0..792c69f 100644 --- a/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj +++ b/PoweredSoft.DynamicQuery/PoweredSoft.DynamicQuery.csproj @@ -19,7 +19,7 @@ - + diff --git a/PoweredSoft.DynamicQuery/QueryHandlerBase.cs b/PoweredSoft.DynamicQuery/QueryHandlerBase.cs index 29da988..56efa21 100644 --- a/PoweredSoft.DynamicQuery/QueryHandlerBase.cs +++ b/PoweredSoft.DynamicQuery/QueryHandlerBase.cs @@ -339,7 +339,7 @@ namespace PoweredSoft.DynamicQuery protected virtual void ApplySimpleFilter(WhereBuilder whereBuilder, ISimpleFilter filter) { var resolvedConditionOperator = ResolveConditionOperatorFrom(filter.Type); - whereBuilder.Compare(filter.Path, resolvedConditionOperator, filter.Value, and: filter.And == true); + whereBuilder.Compare(filter.Path, resolvedConditionOperator, filter.Value, and: filter.And == true, negate: filter.Not == true); } protected virtual IFilter InterceptFilter(IFilter filter) From 19858764a3320922f13b60b884e705341c4a23e2 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 13 Oct 2019 14:11:57 -0500 Subject: [PATCH 3/6] added test for not support. --- PoweredSoft.DynamicQuery.Test/AsyncTests.cs | 28 +++++++++++++++++++++ PoweredSoft.DynamicQuery.Test/GroupTests.cs | 6 +++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/PoweredSoft.DynamicQuery.Test/AsyncTests.cs b/PoweredSoft.DynamicQuery.Test/AsyncTests.cs index fc74c29..a5b5429 100644 --- a/PoweredSoft.DynamicQuery.Test/AsyncTests.cs +++ b/PoweredSoft.DynamicQuery.Test/AsyncTests.cs @@ -118,6 +118,34 @@ namespace PoweredSoft.DynamicQuery.Test }); } + [Fact] + public void SimpleFilterWithNot() + { + MockContextFactory.SeedAndTestContextFor("AsyncTests_SimpleFilter2", TestSeeders.SimpleSeedScenario, async ctx => + { + var resultShouldMatch = ctx.Items.Where(t => !t.Name.EndsWith("Cables")).ToList(); + + var criteria = new QueryCriteria() + { + Filters = new List + { + new SimpleFilter + { + Path = "Name", + Type = FilterType.EndsWith, + Value = "Cables", + Not = true + } + } + }; + + var asyncService = new AsyncQueryableService(new[] { new AsyncQueryableHandlerService() }); + var queryHandler = new QueryHandlerAsync(asyncService); + var result = await queryHandler.ExecuteAsync(ctx.Items, criteria); + Assert.Equal(resultShouldMatch, result.Data); + }); + } + [Fact] public void TestPaging() { diff --git a/PoweredSoft.DynamicQuery.Test/GroupTests.cs b/PoweredSoft.DynamicQuery.Test/GroupTests.cs index 5f9c3b2..5bb87a5 100644 --- a/PoweredSoft.DynamicQuery.Test/GroupTests.cs +++ b/PoweredSoft.DynamicQuery.Test/GroupTests.cs @@ -140,10 +140,11 @@ namespace PoweredSoft.DynamicQuery.Test Count++; } - public async Task AfterReadAsync(List> pairs, CancellationToken cancellationToken = default(CancellationToken)) + public Task AfterReadAsync(List> pairs, CancellationToken cancellationToken = default(CancellationToken)) { Test2 = true; Count++; + return Task.CompletedTask; } public void AfterReadEntity(List entities) @@ -152,10 +153,11 @@ namespace PoweredSoft.DynamicQuery.Test Count++; } - public async Task AfterReadEntityAsync(List entities, CancellationToken cancellationToken = default(CancellationToken)) + public Task AfterReadEntityAsync(List entities, CancellationToken cancellationToken = default(CancellationToken)) { Test4 = true; Count++; + return Task.CompletedTask; } public object InterceptResultTo(Ticket entity) From 707ef3178ea12e8a6452dcb5bc45a172e9e75746 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 13 Oct 2019 15:15:07 -0500 Subject: [PATCH 4/6] json net support is ready, waiting on ms for support of json converter from interfaces. --- DynamicQuery.sln | 22 ++++++++----- .../MvcBuilderExtensions.cs | 19 +++++++++++ ...amicQuery.AspNetCore.NewtonsoftJson.csproj | 33 +++++++++++++++++++ ...PoweredSoft.DynamicQuery.AspNetCore.csproj | 5 --- .../DynamicQueryJsonConverter.cs | 2 +- .../Extensions.cs | 1 - ...redSoft.DynamicQuery.NewtonsoftJson.csproj | 12 +++++++ ...oweredSoft.DynamicQuery.System.Json.csproj | 11 ------- ...dSoft.DynamicQuery.System.Text.Json.csproj | 23 +++++++++++++ 9 files changed, 102 insertions(+), 26 deletions(-) create mode 100644 PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/MvcBuilderExtensions.cs create mode 100644 PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson.csproj delete mode 100644 PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj create mode 100644 PoweredSoft.DynamicQuery.System.Text.Json/PoweredSoft.DynamicQuery.System.Text.Json.csproj diff --git a/DynamicQuery.sln b/DynamicQuery.sln index 07e89e2..6612057 100644 --- a/DynamicQuery.sln +++ b/DynamicQuery.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28010.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29326.143 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.Core", "PoweredSoft.DynamicQuery.Core\PoweredSoft.DynamicQuery.Core.csproj", "{E614658D-6852-4405-B5BE-3695C3E96B13}" EndProject @@ -19,9 +19,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.Te EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.AspNetCore", "PoweredSoft.DynamicQuery.AspNetCore\PoweredSoft.DynamicQuery.AspNetCore.csproj", "{DF58BD18-AB47-4018-B1EA-D1118D93B408}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicQuery.System.Json", "PoweredSoft.DynamicQuery.System.Json\PoweredSoft.DynamicQuery.System.Json.csproj", "{9A196F3E-69F7-4D07-B635-451D3C94E8F9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.NewtonsoftJson", "PoweredSoft.DynamicQuery.NewtonsoftJson\PoweredSoft.DynamicQuery.NewtonsoftJson.csproj", "{201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicQuery.NewtonsoftJson", "PoweredSoft.DynamicQuery.NewtonsoftJson\PoweredSoft.DynamicQuery.NewtonsoftJson.csproj", "{201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.System.Text.Json", "PoweredSoft.DynamicQuery.System.Text.Json\PoweredSoft.DynamicQuery.System.Text.Json.csproj", "{552D67DD-AAB4-4D99-A067-08A593221C84}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson", "PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson\PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson.csproj", "{7BBEEE93-A3DB-443B-8254-E148AC9663EA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -49,14 +51,18 @@ Global {DF58BD18-AB47-4018-B1EA-D1118D93B408}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF58BD18-AB47-4018-B1EA-D1118D93B408}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF58BD18-AB47-4018-B1EA-D1118D93B408}.Release|Any CPU.Build.0 = Release|Any CPU - {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A196F3E-69F7-4D07-B635-451D3C94E8F9}.Release|Any CPU.Build.0 = Release|Any CPU {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Debug|Any CPU.Build.0 = Debug|Any CPU {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Release|Any CPU.ActiveCfg = Release|Any CPU {201D7ACB-E11A-47EE-80F6-3F6BFB947DCA}.Release|Any CPU.Build.0 = Release|Any CPU + {552D67DD-AAB4-4D99-A067-08A593221C84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {552D67DD-AAB4-4D99-A067-08A593221C84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {552D67DD-AAB4-4D99-A067-08A593221C84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {552D67DD-AAB4-4D99-A067-08A593221C84}.Release|Any CPU.Build.0 = Release|Any CPU + {7BBEEE93-A3DB-443B-8254-E148AC9663EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7BBEEE93-A3DB-443B-8254-E148AC9663EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7BBEEE93-A3DB-443B-8254-E148AC9663EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7BBEEE93-A3DB-443B-8254-E148AC9663EA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/MvcBuilderExtensions.cs b/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/MvcBuilderExtensions.cs new file mode 100644 index 0000000..f44d4af --- /dev/null +++ b/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/MvcBuilderExtensions.cs @@ -0,0 +1,19 @@ +using Microsoft.Extensions.DependencyInjection; +using PoweredSoft.DynamicQuery.NewtonsoftJson; + +namespace PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson +{ + public static class MvcBuilderExtensions + { + public static IMvcBuilder AddPoweredSoftJsonNetDynamicQuery(this IMvcBuilder mvcBuilder, bool enableStringEnumConverter = true) + { + mvcBuilder.AddPoweredSoftDynamicQuery(); + var serviceProvider = mvcBuilder.Services.BuildServiceProvider(); + mvcBuilder.AddNewtonsoftJson(o => + { + o.SerializerSettings.AddPoweredSoftDynamicQueryNewtonsoftJson(serviceProvider, enableStringEnumConverter: enableStringEnumConverter); + }); + return mvcBuilder; + } + } +} diff --git a/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson.csproj b/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson.csproj new file mode 100644 index 0000000..4f61d67 --- /dev/null +++ b/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson.csproj @@ -0,0 +1,33 @@ + + + + netcoreapp3.0 + Powered Softwares Inc. + MIT + https://github.com/PoweredSoft/DynamicQuery + https://github.com/PoweredSoft/DynamicQuery + github + powered,soft,dynamic,criteria,query,builder,asp,net,core + 2.1.0$(VersionSuffix) + https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&r=g&d=retro + This projects makes it easier to use dynamic query in a asp.net core mvc project. + PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson + False + Powered Soft + David Lebee + + + + + + + + + + + + + + + + diff --git a/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj b/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj index c3b8d3e..7a54fa8 100644 --- a/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj +++ b/PoweredSoft.DynamicQuery.AspNetCore/PoweredSoft.DynamicQuery.AspNetCore.csproj @@ -22,11 +22,6 @@ - - - - - diff --git a/PoweredSoft.DynamicQuery.NewtonsoftJson/DynamicQueryJsonConverter.cs b/PoweredSoft.DynamicQuery.NewtonsoftJson/DynamicQueryJsonConverter.cs index 0ddff86..7efbe16 100644 --- a/PoweredSoft.DynamicQuery.NewtonsoftJson/DynamicQueryJsonConverter.cs +++ b/PoweredSoft.DynamicQuery.NewtonsoftJson/DynamicQueryJsonConverter.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace PoweredSoft.DynamicQuery.AspNetCore.Json +namespace PoweredSoft.DynamicQuery.NewtonsoftJson { public class DynamicQueryJsonConverter : JsonConverter { diff --git a/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs b/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs index 37c055b..e9f58a5 100644 --- a/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs +++ b/PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using PoweredSoft.DynamicQuery.AspNetCore.Json; using System; namespace PoweredSoft.DynamicQuery.NewtonsoftJson diff --git a/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj b/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj index 63d0ffd..dbe2cbd 100644 --- a/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj +++ b/PoweredSoft.DynamicQuery.NewtonsoftJson/PoweredSoft.DynamicQuery.NewtonsoftJson.csproj @@ -2,6 +2,18 @@ netstandard2.0 + Powered Softwares Inc. + MIT + https://github.com/PoweredSoft/DynamicQuery + https://github.com/PoweredSoft/DynamicQuery.Core/ + github + powered,soft,dynamic,criteria,query,builder + 2.1.0$(VersionSuffix) + https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&r=g&d=retro + PoweredSoft.DynamicQuery.Newtonsoft.Json + False + Poweredsoft + David Lebee diff --git a/PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj b/PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj deleted file mode 100644 index 628e596..0000000 --- a/PoweredSoft.DynamicQuery.System.Json/PoweredSoft.DynamicQuery.System.Json.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - netstandard2.0 - - - - - - - diff --git a/PoweredSoft.DynamicQuery.System.Text.Json/PoweredSoft.DynamicQuery.System.Text.Json.csproj b/PoweredSoft.DynamicQuery.System.Text.Json/PoweredSoft.DynamicQuery.System.Text.Json.csproj new file mode 100644 index 0000000..f45990e --- /dev/null +++ b/PoweredSoft.DynamicQuery.System.Text.Json/PoweredSoft.DynamicQuery.System.Text.Json.csproj @@ -0,0 +1,23 @@ + + + + netcoreapp3.0 + Powered Softwares Inc. + MIT + https://github.com/PoweredSoft/DynamicQuery + https://github.com/PoweredSoft/DynamicQuery.Core/ + github + powered,soft,dynamic,criteria,query,builder + 2.1.0$(VersionSuffix) + https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&r=g&d=retro + PoweredSoft.DynamicQuery.System.Text.Json + False + Poweredsoft + David Lebee + + + + + + + From 522c37deaff05482bc03de9dc38495961db32ab4 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 13 Oct 2019 15:34:32 -0500 Subject: [PATCH 5/6] deserialize --- PoweredSoft.DynamicQuery.Test/DeserializeTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs b/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs index 2e8dfe4..a8988f2 100644 --- a/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs +++ b/PoweredSoft.DynamicQuery.Test/DeserializeTests.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using PoweredSoft.DynamicQuery.AspNetCore.Json; using PoweredSoft.DynamicQuery.Core; +using PoweredSoft.DynamicQuery.NewtonsoftJson; using System; using System.Collections.Generic; using System.Text; From 857a9aa183625ca2df2b5807aa881b0c33ea0655 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 13 Oct 2019 16:37:32 -0500 Subject: [PATCH 6/6] updated docs. --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 86a1210..821c082 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,18 @@ Full Version | NuGet PoweredSoft.DynamicQuery | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.DynamicQuery.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.DynamicQuery/) | ```PM> Install-Package PoweredSoft.DynamicQuery``` PoweredSoft.DynamicQuery.Core | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.DynamicQuery.Core.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.DynamicQuery.Core/) | ```PM> Install-Package PoweredSoft.DynamicQuery.Core``` PoweredSoft.DynamicQuery.AspNetCore | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.DynamicQuery.AspNetCore.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.DynamicQuery.AspNetCore/) | ```PM> Install-Package PoweredSoft.DynamicQuery.AspNetCore``` +PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson/) | ```PM> Install-Package PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson``` ## Using in ASP.NET Core The package Asp.net core of dynamic query will help you start to use Dynamic Query faster in your web project. -### How to configure during startup +> For NET CORE 2.x look at v2.0 branch. + +### How to configure during startup (NET Core 3) ```csharp -using PoweredSoft.DynamicQuery.AspNetCore; +using PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson; public class Startup { @@ -34,7 +37,7 @@ public class Startup { services .AddMvc() - .AddPoweredSoftDynamicQuery(); + .AddPoweredSoftJsonNetDynamicQuery(); } }