2021-11-23 03:14:31 +08:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2022-04-26 18:29:18 +08:00
|
|
|
|
using Newtonsoft.Json.Serialization;
|
|
|
|
|
|
using SqlSugar;
|
2021-11-23 03:14:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
2022-10-20 18:11:54 +08:00
|
|
|
|
using System.Text.Json.Serialization;
|
2021-11-23 03:14:31 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Yi.Framework.WebCore.BuilderExtend
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class JsonExtension
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void AddJsonFileService(this IMvcBuilder builder)
|
|
|
|
|
|
{
|
2022-10-20 18:11:54 +08:00
|
|
|
|
builder.AddJsonOptions(options =>
|
|
|
|
|
|
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
|
|
|
|
|
|
|
2021-11-23 03:14:31 +08:00
|
|
|
|
builder.AddNewtonsoftJson(options =>
|
|
|
|
|
|
{
|
|
|
|
|
|
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
2022-10-28 17:38:14 +08:00
|
|
|
|
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
2022-10-20 18:11:54 +08:00
|
|
|
|
|
2022-04-26 18:29:18 +08:00
|
|
|
|
//options.SerializerSettings.Converters.Add(new ValueToStringConverter());
|
2021-11-23 03:14:31 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|