增加功能:增加Json全局设置
This commit is contained in:
parent
b3a5d4c587
commit
07337b1968
|
@ -15,6 +15,8 @@ using Microsoft.AspNetCore.Http;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
|
@ -52,6 +54,11 @@ namespace Bootstrap.Client
|
|||
{
|
||||
options.Filters.Add<BootstrapAdminAuthorizeFilter>();
|
||||
options.Filters.Add<ExceptionFilter>();
|
||||
}).AddJsonOptions(options =>
|
||||
{
|
||||
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
JsonConvert.DefaultSettings = () => options.SerializerSettings;
|
||||
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options =>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue