You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.7 KiB
C#

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;
1 year ago
namespace Aucma.Core.PrintTo
{
/// <summary>
/// Startup
/// </summary>
public class Startup
{
/// <summary>
/// Startup
/// </summary>
/// <param name="configuration"></param>
public Startup(IConfiguration configuration, IWebHostEnvironment env)
{
Configuration = configuration;
Env = env;
}
/// <summary>
/// IConfiguration
/// </summary>
public IConfiguration Configuration { get; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>
/// </summary>
public IWebHostEnvironment Env { get; }
/// <summary>
/// This method gets called by the runtime. Use this method to add services to the container.
/// </summary>
/// <param name="services"></param>
public void ConfigureServices(IServiceCollection services)
{
//Appsettings
services.AddSingleton(new Appsettings(Configuration));
//<2F><>־<EFBFBD>ļ<EFBFBD>Ŀ¼
services.AddSingleton(new LogLock(Env.ContentRootPath));
//Memory<72><79><EFBFBD><EFBFBD>
services.AddMemoryCacheSetup();
//Sqlsugar<61><72><EFBFBD>ݿ<EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD>ѯ
services.AddSqlsugarSetup();
//AutoMapper
services.AddAutoMapperSetup();
//֧<>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>ȫ <20><><EFBFBD><EFBFBD><><D6A7> System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030")
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
/// <summary>
/// ע<><D7A2><EFBFBD><EFBFBD>Program.CreateHostBuilder<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Autofac<61><63><EFBFBD>񹤳<EFBFBD>
/// </summary>
/// <param name="builder"></param>
public void ConfigureContainer(ContainerBuilder builder)
{
builder.RegisterModule(new AutofacModuleRegister());
builder.RegisterModule<AutofacPropertityModuleReg>();
}
/// <summary>
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app)
{
// ʹ<>þ<EFBFBD>̬<EFBFBD>ļ<EFBFBD>
app.UseStaticFiles();
}
}
}