模型注册

This commit is contained in:
chfei committed 2026-09-18 19:17:11 +08:00
1 parent 75d0e85218
commit 0e1620c1f9
11 files changed
+399 -41

No files matched your search

+7 -3
View File
@@ -1,4 +1,4 @@
using Asp.Versioning;
using Asp.Versioning;
using MAX.Framework.DependencyInjection;
using Scalar.AspNetCore;
@@ -8,8 +8,9 @@ public partial class Program
{
var builder = WebApplication.CreateBuilder(args);
// IOC 注册:自动注册 ISingletonDependency / IScopedDependency / ITransientDependency,并执行所有 IStartup(实现见 StoreHub.Framework)
builder.Services.AddStoreHub();
// IOC 注册:自动注册 ISingletonDependency / IScopedDependency / ITransientDependency,并执行所有 IStartup / IModule.AddModule
// 模块服务注册阶段(等价于 builder.Services.AddStoreHub(builder.Configuration, builder.Environment),额外把配置/环境交给模块)
builder.AddStoreHub();
builder.Services.AddFreeSqlDB();
// JWT 验证:注册 JwtBearer 认证 + 令牌服务 + OpenAPI Bearer 安全方案(配置节 Jwt)
builder.Services.AddStoreHubJwt(builder.Configuration);
@@ -62,6 +63,9 @@ public partial class Program
app.UseAuthorization();
// 模块管道装配阶段:执行所有 IModule.UseModule(Hangfire 看板、定时任务等),必须在 Run() 之前
app.UseStoreHubModules();
app.MapControllers();
app.Run();