cleaner like this :)

This commit is contained in:
David Lebee 2018-11-23 00:17:05 -06:00
parent 063a1cad61
commit 344caf689e
3 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Converters;
using PoweredSoft.DynamicQuery.AspNetCore.Json; using PoweredSoft.DynamicQuery.AspNetCore.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -8,10 +9,13 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
{ {
public static class MvcBuilderExtensions 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 => builder.AddJsonOptions(o =>
{ {
o.SerializerSettings.Converters.Add(new StringEnumConverter());
o.SerializerSettings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider)); o.SerializerSettings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider));
}); });
return builder; return builder;

View File

@ -9,7 +9,7 @@
<RepositoryUrl>https://github.com/PoweredSoft/DynamicQuery</RepositoryUrl> <RepositoryUrl>https://github.com/PoweredSoft/DynamicQuery</RepositoryUrl>
<RepositoryType>github</RepositoryType> <RepositoryType>github</RepositoryType>
<PackageTags>powered,soft,dynamic,criteria,query,builder,asp,net,core</PackageTags> <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;amp;r=g&amp;amp;d=retro</PackageIconUrl> <PackageIconUrl>https://secure.gravatar.com/avatar/4e32f73820c16718909a06c2927f1f8b?s=512&amp;amp;r=g&amp;amp;d=retro</PackageIconUrl>
</PropertyGroup> </PropertyGroup>

View File

@ -8,7 +8,7 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
{ {
public static class ServiceCollectionExtensions public static class ServiceCollectionExtensions
{ {
public static void AddDynamicQueryDefaultMappings(this IServiceCollection services) public static IServiceCollection AddPoweredSoftDynamicQuery(this IServiceCollection services)
{ {
services.AddTransient<ISort, Sort>(); services.AddTransient<ISort, Sort>();
services.AddTransient<IAggregate, Aggregate>(); services.AddTransient<IAggregate, Aggregate>();
@ -17,6 +17,7 @@ namespace PoweredSoft.DynamicQuery.AspNetCore
services.AddTransient<IGroup, Group>(); services.AddTransient<IGroup, Group>();
services.AddTransient<IQueryCriteria, QueryCriteria>(); services.AddTransient<IQueryCriteria, QueryCriteria>();
services.AddTransient<IQueryHandler, QueryHandler>(); services.AddTransient<IQueryHandler, QueryHandler>();
return services;
} }
} }
} }