2021-08-13 14:55:08 -04:00
|
|
|
|
using Newtonsoft.Json;
|
2019-10-13 15:06:47 -04:00
|
|
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|