not ready for ef core 3 yet but allowing aspnet core 3
This commit is contained in:
parent
a74b635332
commit
c300906c5e
@ -19,6 +19,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.Te
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.AspNetCore", "PoweredSoft.DynamicQuery.AspNetCore\PoweredSoft.DynamicQuery.AspNetCore.csproj", "{DF58BD18-AB47-4018-B1EA-D1118D93B408}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicQuery.AspNetCore", "PoweredSoft.DynamicQuery.AspNetCore\PoweredSoft.DynamicQuery.AspNetCore.csproj", "{DF58BD18-AB47-4018-B1EA-D1118D93B408}"
|
||||||
EndProject
|
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
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{DF58BD18-AB47-4018-B1EA-D1118D93B408}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Newtonsoft.Json.Converters;
|
|
||||||
using PoweredSoft.Data;
|
using PoweredSoft.Data;
|
||||||
using PoweredSoft.DynamicQuery.AspNetCore.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -14,12 +12,6 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
|
|||||||
{
|
{
|
||||||
builder.Services.AddPoweredSoftDataServices();
|
builder.Services.AddPoweredSoftDataServices();
|
||||||
builder.Services.AddPoweredSoftDynamicQuery();
|
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;
|
return builder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<Copyright>Powered Softwares Inc.</Copyright>
|
<Copyright>Powered Softwares Inc.</Copyright>
|
||||||
<PackageLicenseUrl>MIT</PackageLicenseUrl>
|
<PackageLicenseUrl>MIT</PackageLicenseUrl>
|
||||||
<PackageProjectUrl>https://github.com/PoweredSoft/DynamicQuery</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/PoweredSoft/DynamicQuery</PackageProjectUrl>
|
||||||
@ -19,8 +19,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
{
|
{
|
||||||
string Path { get; set; }
|
string Path { get; set; }
|
||||||
object Value { get; set; }
|
object Value { get; set; }
|
||||||
|
bool? Not { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,8 @@
|
|||||||
<Authors>David Lebee</Authors>
|
<Authors>David Lebee</Authors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
20
PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs
Normal file
20
PoweredSoft.DynamicQuery.NewtonsoftJson/Extensions.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PoweredSoft.DynamicQuery.Core\PoweredSoft.DynamicQuery.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -22,6 +22,7 @@ namespace PoweredSoft.DynamicQuery.Test
|
|||||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||||
|
|
||||||
var settings = new JsonSerializerSettings();
|
var settings = new JsonSerializerSettings();
|
||||||
|
|
||||||
settings.Converters.Add(new StringEnumConverter());
|
settings.Converters.Add(new StringEnumConverter());
|
||||||
settings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider));
|
settings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider));
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ namespace PoweredSoft.DynamicQuery.Test
|
|||||||
public FilterType Type { get; set; } = FilterType.Equal;
|
public FilterType Type { get; set; } = FilterType.Equal;
|
||||||
public string Path { get; set; } = "FirstName";
|
public string Path { get; set; } = "FirstName";
|
||||||
public object Value { get; set; } = "Chuck";
|
public object Value { get; set; } = "Chuck";
|
||||||
|
public bool? Not { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol;
|
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
|
|
||||||
@ -12,7 +13,12 @@ namespace PoweredSoft.DynamicQuery.Test.Mock
|
|||||||
{
|
{
|
||||||
public static void TestContextFor(string testName, Action<MockContext> action)
|
public static void TestContextFor(string testName, Action<MockContext> action)
|
||||||
{
|
{
|
||||||
var options = new DbContextOptionsBuilder<MockContext>().UseInMemoryDatabase(databaseName: testName).Options;
|
var options = new DbContextOptionsBuilder<MockContext>()
|
||||||
|
.ConfigureWarnings(warnings =>
|
||||||
|
warnings.Ignore(RelationalEventId.QueryClientEvaluationWarning)
|
||||||
|
)
|
||||||
|
.UseInMemoryDatabase(databaseName: testName).Options;
|
||||||
|
|
||||||
using (var ctx = new MockContext(options))
|
using (var ctx = new MockContext(options))
|
||||||
action(ctx);
|
action(ctx);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Bogus" Version="28.0.2" />
|
<PackageReference Include="Bogus" Version="28.3.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.6" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||||
<PackageReference Include="PoweredSoft.Data.EntityFrameworkCore" Version="1.1.3" />
|
<PackageReference Include="PoweredSoft.Data.EntityFrameworkCore" Version="1.1.3" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
@ -21,6 +23,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PoweredSoft.DynamicQuery.AspNetCore\PoweredSoft.DynamicQuery.AspNetCore.csproj" />
|
<ProjectReference Include="..\PoweredSoft.DynamicQuery.AspNetCore\PoweredSoft.DynamicQuery.AspNetCore.csproj" />
|
||||||
|
<ProjectReference Include="..\PoweredSoft.DynamicQuery.NewtonsoftJson\PoweredSoft.DynamicQuery.NewtonsoftJson.csproj" />
|
||||||
<ProjectReference Include="..\PoweredSoft.DynamicQuery\PoweredSoft.DynamicQuery.csproj" />
|
<ProjectReference Include="..\PoweredSoft.DynamicQuery\PoweredSoft.DynamicQuery.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace PoweredSoft.DynamicQuery
|
|||||||
public class SimpleFilter : ISimpleFilter
|
public class SimpleFilter : ISimpleFilter
|
||||||
{
|
{
|
||||||
public bool? And { get; set; }
|
public bool? And { get; set; }
|
||||||
|
public bool? Not { get; set; }
|
||||||
public FilterType Type { get; set; }
|
public FilterType Type { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public object Value { get; set; }
|
public object Value { get; set; }
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
|
||||||
<PackageReference Include="PoweredSoft.Data" Version="1.1.3" />
|
<PackageReference Include="PoweredSoft.Data" Version="1.1.3" />
|
||||||
<PackageReference Include="PoweredSoft.DynamicLinq" Version="1.1.8" />
|
<PackageReference Include="PoweredSoft.DynamicLinq" Version="1.1.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -339,7 +339,7 @@ namespace PoweredSoft.DynamicQuery
|
|||||||
protected virtual void ApplySimpleFilter<TSource>(WhereBuilder whereBuilder, ISimpleFilter filter)
|
protected virtual void ApplySimpleFilter<TSource>(WhereBuilder whereBuilder, ISimpleFilter filter)
|
||||||
{
|
{
|
||||||
var resolvedConditionOperator = ResolveConditionOperatorFrom(filter.Type);
|
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<TSource>(IFilter filter)
|
protected virtual IFilter InterceptFilter<TSource>(IFilter filter)
|
||||||
|
Loading…
Reference in New Issue
Block a user