From a4f725f0fc99e1e51106af1b60263ac3bd2a7c30 Mon Sep 17 00:00:00 2001 From: 展杰 <1240968267@qq.com> Date: 星期二, 13 八月 2024 10:09:14 +0800 Subject: [PATCH] 合并上格新增代码 --- MESApplication/Startup.cs | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/MESApplication/Startup.cs b/MESApplication/Startup.cs index fb5ae6c..f506f0e 100644 --- a/MESApplication/Startup.cs +++ b/MESApplication/Startup.cs @@ -1,4 +1,6 @@ -锘縰sing Microsoft.OpenApi.Models; +锘縰sing MES.Service.Dto.@base; +using MES.Service.util; +using Microsoft.OpenApi.Models; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Swashbuckle.AspNetCore.SwaggerUI; @@ -13,6 +15,8 @@ public Startup(IConfiguration configuration) { Configuration = configuration; + + new AppsettingsUtility().Initial(configuration); } public IConfiguration Configuration { get; } @@ -21,11 +25,16 @@ public void ConfigureServices(IServiceCollection services) { services.AddControllers(); + + // 璇诲彇 绯荤粺 璁剧疆骞舵敞鍏ュ埌鏈嶅姟涓� + services.Configure<AppSettings>( + Configuration.GetSection("AppSettings")); + services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo - { Title = "WebFirst.Api", Version = "v1" }); + { Title = "MESApplication.Api", Version = "v1" }); }); //閰嶇疆JSON.NET @@ -42,6 +51,9 @@ // 璁剧疆鍛藉悕绛栫暐涓洪┘宄板懡鍚� opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + + //杩斿洖缁欏墠绔殑鏃堕棿鏍煎紡鍖� + opt.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; }); //閰嶇疆鍙互璺ㄥ煙 -- Gitblit v1.9.3