LR-20210131IOQH\Administrator
2021-08-10 11e11a51839529b17f70927524e086e90adf692d
zhengcaioa/zhengcaioa/Startup.cs
@@ -25,6 +25,7 @@
using zhengcaioa.Model;
using zhengcaioa.Models;
using zhengcaioa.Service;
using zhengcaioa.Timer;
namespace zhengcaioa
{
@@ -46,11 +47,12 @@
                options.AddPolicy("any", builder =>
                {
                    builder.WithMethods("GET", "POST", "HEAD", "PUT", "DELETE", "OPTIONS")
                       .AllowAnyHeader()
                    //.AllowCredentials()//指定处理cookie
                .AllowAnyOrigin(); //允许任何来源的主机访问
                });
            });
            //services.AddCors(option => option.AddPolicy("cors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().AllowAnyOrigin()));
            services.AddSession(options =>
            {
@@ -62,11 +64,16 @@
                options.CheckConsentNeeded = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });
            services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
            var connectionString = Configuration.GetConnectionString("DefaultConnection");
            services.AddDbContext<zhengcaioaContext>(options =>
            options.UseSqlServer(connectionString));
            options.UseSqlServer(connectionString));
            services.AddControllersWithViews();
            services.AddScoped(typeof(ISimService), typeof(SimService));
            services.AddScoped(typeof(IHrSalaryService), typeof(HrSalaryService));
            services.AddScoped(typeof(IUserService), typeof(UserService));
            services.AddScoped(typeof(ILiaotianService), typeof(LiaotianService));
            services.AddScoped(typeof(IProjectService), typeof(ProjectService));
@@ -111,7 +118,19 @@
            services.AddScoped(typeof(IFiBookService), typeof(FiBookService));
            services.AddScoped(typeof(IAdmAttendanceRuleService), typeof(AdmAttendanceRuleService));
            services.AddScoped(typeof(IAdmAttendanceDtlService), typeof(AdmAttendanceDtlService));
            services.AddScoped(typeof(IAdmAttendanceService), typeof(AdmAttendanceService));
            services.AddScoped(typeof(IHrJibengongziService), typeof(HrJibengongziService));
            services.AddScoped(typeof(IHrJixiaotichengService), typeof(HrJixiaotichengService));
            services.AddScoped(typeof(IHrSalaryService), typeof(HrSalaryService));
            //定时执行
            services.AddHostedService<TimedBackgroundService>();
            services.AddAutoMapper(typeof(AutoMapperConfigs));
            services.AddUEditorService("ueditor.json", true, "wwwroot");