2023-01-29 21:13:20 +08:00
|
|
|
using AspNetCore.Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Yi.Framework.Core.Autofac.Extensions;
|
|
|
|
|
using Yi.Framework.Core.Autofac.Modules;
|
|
|
|
|
using Yi.Framework.Core.Extensions;
|
2023-01-30 14:44:24 +08:00
|
|
|
using Yi.RBAC.Application;
|
2023-01-29 21:13:20 +08:00
|
|
|
using Yi.RBAC.Web;
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
//设置启动url
|
|
|
|
|
builder.WebHost.UseStartUrlsServer(builder.Configuration);
|
|
|
|
|
|
|
|
|
|
//添加模块
|
|
|
|
|
builder.UseYiModules(typeof(YiRBACWebModule));
|
|
|
|
|
|
|
|
|
|
//添加autofac模块,需要添加模块
|
|
|
|
|
builder.Host.ConfigureAutoFacContainer(container =>
|
|
|
|
|
{
|
2023-01-30 14:44:24 +08:00
|
|
|
container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiRBACApplicationModule).Assembly);
|
2023-01-29 21:13:20 +08:00
|
|
|
});
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
//全局错误中间件,需要放在最早
|
|
|
|
|
app.UseErrorHandlingServer();
|
|
|
|
|
|
|
|
|
|
app.UseAuthentication();
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
|
|
app.Run();
|