cleaner like this :)
This commit is contained in:
parent
063a1cad61
commit
344caf689e
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using PoweredSoft.DynamicQuery.AspNetCore.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -8,10 +9,13 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
|
||||
{
|
||||
public static class MvcBuilderExtensions
|
||||
{
|
||||
public static IMvcBuilder AddDynamicQueryJsonConverter(this IMvcBuilder builder, IServiceProvider serviceProvider)
|
||||
public static IMvcBuilder AddPoweredSoftDynamicQuery(this IMvcBuilder builder)
|
||||
{
|
||||
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;
|
||||
|
@ -9,7 +9,7 @@
|
||||
<RepositoryUrl>https://github.com/PoweredSoft/DynamicQuery</RepositoryUrl>
|
||||
<RepositoryType>github</RepositoryType>
|
||||
<PackageTags>powered,soft,dynamic,criteria,query,builder,asp,net,core</PackageTags>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
<PackageIconUrl>https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&amp;r=g&amp;d=retro</PackageIconUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
|
||||
{
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static void AddDynamicQueryDefaultMappings(this IServiceCollection services)
|
||||
public static IServiceCollection AddPoweredSoftDynamicQuery(this IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<ISort, Sort>();
|
||||
services.AddTransient<IAggregate, Aggregate>();
|
||||
@ -17,6 +17,7 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
|
||||
services.AddTransient<IGroup, Group>();
|
||||
services.AddTransient<IQueryCriteria, QueryCriteria>();
|
||||
services.AddTransient<IQueryHandler, QueryHandler>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user