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)