2018-11-18 06:33:37 -05:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2018-11-23 01:17:05 -05:00
|
|
|
|
using Newtonsoft.Json.Converters;
|
2019-02-13 21:25:39 -05:00
|
|
|
|
using PoweredSoft.Data;
|
2018-11-18 06:33:37 -05:00
|
|
|
|
using PoweredSoft.DynamicQuery.AspNetCore.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace PoweredSoft.DynamicQuery.AspNetCore
|
|
|
|
|
{
|
|
|
|
|
public static class MvcBuilderExtensions
|
|
|
|
|
{
|
2018-11-23 01:17:05 -05:00
|
|
|
|
public static IMvcBuilder AddPoweredSoftDynamicQuery(this IMvcBuilder builder)
|
2018-11-18 06:33:37 -05:00
|
|
|
|
{
|
2019-02-13 21:25:39 -05:00
|
|
|
|
builder.Services.AddPoweredSoftDataServices();
|
2018-11-23 01:17:05 -05:00
|
|
|
|
builder.Services.AddPoweredSoftDynamicQuery();
|
|
|
|
|
var serviceProvider = builder.Services.BuildServiceProvider();
|
2018-11-18 06:33:37 -05:00
|
|
|
|
builder.AddJsonOptions(o =>
|
|
|
|
|
{
|
2018-11-23 01:17:05 -05:00
|
|
|
|
o.SerializerSettings.Converters.Add(new StringEnumConverter());
|
2018-11-18 06:33:37 -05:00
|
|
|
|
o.SerializerSettings.Converters.Add(new DynamicQueryJsonConverter(serviceProvider));
|
|
|
|
|
});
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|