| | |
| | | using Microsoft.OpenApi.Models; |
| | | using MES.Service.Dto.@base; |
| | | using MES.Service.util; |
| | | using Microsoft.OpenApi.Models; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using Swashbuckle.AspNetCore.SwaggerUI; |
| | |
| | | public Startup(IConfiguration configuration) |
| | | { |
| | | Configuration = configuration; |
| | | |
| | | new AppsettingsUtility().Initial(configuration); |
| | | } |
| | | |
| | | public IConfiguration Configuration { get; } |
| | |
| | | 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 |
| | |
| | | // 设置命名策略为驼峰命名 |
| | | opt.SerializerSettings.ContractResolver = |
| | | new CamelCasePropertyNamesContractResolver(); |
| | | |
| | | //返回给前端的时间格式化 |
| | | opt.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; |
| | | }); |
| | | |
| | | //配置可以跨域 |