using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SlnMesnac.Config; using SlnMesnac.Common; using SlnMesnac.Quartz; using SlnMesnac.Repository; using SlnMesnac.Plc; using SlnMesnac.Serilog; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; namespace SlnMesnac.WPF { /// /// /// public class Startup { /// /// This method gets called by the runtime. Use this method to add services to the container. /// /// [Obsolete] public void ConfigureServices(IServiceCollection services) { services.AddControllers(); //注册配置类 services.AddSingleton(provider => { var configuration = provider.GetService(); return configuration.GetSection("AppConfig").Get(); }); //注册通用类 services.AddCommonSetup(); //注册SqlSugar services.AddSqlSugarSetup(); //注册服务 services.AddServices(); //注册任务调度 services.AddQuartzSetUp(); //注册PLC services.AddPlcSetup(); } /// /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// /// /// public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //启用Serilog中间件 app.UseSerilogExtensions(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); } } }