using AUTS_Server.Service;
using ProjectIntegration;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllersWithViews();
// 注册HttpContextAccessor
builder.Services.AddHttpContextAccessor();
builder.Services.AddSqlSugarClients(builder.Configuration);//注入sqlsugar
builder.Services.AddScoped<IEncryptionService, EncryptionService>();//注入加密服务
builder.Services.AddScoped<IUserOperationLog, UserOperationLog>();///注入用户操作日志服务写入数据库
builder.Services.AddScoped<ILogHelperForService, LogHelperForService>();//注入日志服务io操作记录代码里面的操作错误
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.MapControllerRoute(
    name: "default", 
    pattern: "{controller=Login}/{action=Index}/{id?}");

app.Run();
