把一些项目移动到插件中

This commit is contained in:
chfei committed 2026-10-22 15:12:56 +08:00
1 parent d0f9f00b76
commit 5ff52dea92
60 files changed
+410 -27

No files matched your search

@@ -36,7 +36,7 @@ namespace MAX.Framework.DependencyInjection
host.AddLogger();
//host.Services.AddSingleton<ILoggerFacade>(NLogger.Instance);//注册log
IEnumerable<Assembly> assemblies = GetApplicationAssemblies();
IEnumerable<Assembly> assemblies = StoreAppTypeFinder.Current.GetAssemblies(host.Configuration["Plugins:Path"]).ToArray();
// 同一个类可能同时实现 IStartup 与 IModule,这里缓存实例,保证两个阶段拿到的是同一个对象
Dictionary<Type, object> instances = [];
return AddStoreCore(host, assemblies, instances);
@@ -62,7 +62,7 @@ namespace MAX.Framework.DependencyInjection
host.Services.AddControllers(options =>
var mvc = host.Services.AddControllers(options =>
{
options.Filters.Add<GlobalExceptionFilter>();
options.Filters.Add<UnifyResultFilter>();
@@ -87,6 +87,10 @@ namespace MAX.Framework.DependencyInjection
};
});
foreach (var assembly in assemblies)
{
mvc.AddApplicationPart(assembly);
}
return host.Services;
}
@@ -154,7 +158,7 @@ namespace MAX.Framework.DependencyInjection
catch (Exception ex)
{
// 带上模块名,避免只看到一个没有上下文的异常
throw new InvalidOperationException($"模块 {module.GetType().FullName} 的 AddModule 执行失败。", ex);
throw new InvalidOperationException($"模块 {module.GetType().FullName} 的 AddModule 执行失败:{ex.Message}", ex);
}
}
}