using Admin.Core.Common; using Admin.Core.Extensions; using Admin.Core.IRepository; using Admin.Core.IService; using Admin.Core.IService.ISys; using Admin.Core.Model; using Admin.Core.Repository; using Admin.Core.Service; using Admin.Core.Tasks; using Autofac; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System.Text; namespace Aucma.Core.PrintTo { /// /// Startup /// public class Startup { /// /// Startup /// /// public Startup(IConfiguration configuration, IWebHostEnvironment env) { Configuration = configuration; Env = env; } /// /// IConfiguration /// public IConfiguration Configuration { get; } /// /// 环境信息:开发/生产 /// public IWebHostEnvironment Env { get; } /// /// This method gets called by the runtime. Use this method to add services to the container. /// /// public void ConfigureServices(IServiceCollection services) { //Appsettings services.AddSingleton(new Appsettings(Configuration)); //日志文件目录 services.AddSingleton(new LogLock(Env.ContentRootPath)); //Memory缓存 services.AddMemoryCacheSetup(); //Sqlsugar数据库模型查询 services.AddSqlsugarSetup(); //AutoMapper services.AddAutoMapperSetup(); //支持编码大全 例如:支持 System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030") Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); } /// /// 注意在Program.CreateHostBuilder,添加Autofac服务工厂 /// /// public void ConfigureContainer(ContainerBuilder builder) { builder.RegisterModule(new AutofacModuleRegister()); builder.RegisterModule(); } /// /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// /// /// public void Configure(IApplicationBuilder app) { // 使用静态文件 app.UseStaticFiles(); } } }