如何覆盖 AbpUserConfigurationController?
How to override the AbpUserConfigurationController?
不知道AbpUserConfigurationController的底层原理?它是如何注入到aspnet core DI容器中的?为什么在Swagger页面看不到呢?我正在使用 aspnetboilerplate 高级启动模板。
覆盖AbpUserConfigurationController
您可以使用aspnetboilerplate/#3296(comment)
中提到的方法
了解Abp如何将controller注入AspNetCore项目
由@tseng解释,可以通过ApplicationPartManager
的AddApplicationPart
添加控制器。
Abp 在一些地方使用 ApplicationPartManager
来包含额外的控制器。
在Abp.AspNetCore
中,正如@tseng所指出的,在AbpAspNetCoreModule#L47-78,这里的实现是包括在 Abp.AspNetCore
程序集中创建的控制器。
在下载的模板中,您可以在*.*.Web.Core
项目下寻找*WebCoreModule.cs
。下面的代码片段是Abp将MyProjectApplicationModule
程序集中的所有应用服务转为controller的另一个地方
Configuration.Modules.AbpAspNetCore()
.CreateControllersForAppServices(
typeof(MyProjectApplicationModule).GetAssembly()
);
您还可以查看 AbpAspNetCoreConfiguration.cs#L47-L55 正在更新 ControllerAssemblySettings
的位置。
请注意,CreateControllersForAppServices
在 AbpModule
的 PreInitialize()
中调用,AddApplicationParts
在 AbpAspNetCoreModule
的 PostInitialize()
中调用。
因此AbpAspNetCoreModule
的方法AddApplicationParts
中使用的ControllerAssemblySettings
已经包含了所有要通过ApplicationPartManager
添加的控制器
理解为什么AbpUserConfigurationController
没有大摇大摆地出现-ui
简而言之,常规路由不被Swagger
支持,参见swashbuckle-apiexplorer-and-routing。
TokenAuthController
出现在 swagger-ui
是因为它装饰有 [Route("api/[controller]/[action]")]
(属性路由)
不知道AbpUserConfigurationController的底层原理?它是如何注入到aspnet core DI容器中的?为什么在Swagger页面看不到呢?我正在使用 aspnetboilerplate 高级启动模板。
覆盖AbpUserConfigurationController
您可以使用aspnetboilerplate/#3296(comment)
中提到的方法了解Abp如何将controller注入AspNetCore项目
由@tseng解释,可以通过ApplicationPartManager
的AddApplicationPart
添加控制器。
Abp 在一些地方使用 ApplicationPartManager
来包含额外的控制器。
在
Abp.AspNetCore
中,正如@tseng所指出的,在AbpAspNetCoreModule#L47-78,这里的实现是包括在Abp.AspNetCore
程序集中创建的控制器。在下载的模板中,您可以在
*.*.Web.Core
项目下寻找*WebCoreModule.cs
。下面的代码片段是Abp将MyProjectApplicationModule
程序集中的所有应用服务转为controller的另一个地方
Configuration.Modules.AbpAspNetCore()
.CreateControllersForAppServices(
typeof(MyProjectApplicationModule).GetAssembly()
);
您还可以查看 AbpAspNetCoreConfiguration.cs#L47-L55 正在更新 ControllerAssemblySettings
的位置。
请注意,CreateControllersForAppServices
在 AbpModule
的 PreInitialize()
中调用,AddApplicationParts
在 AbpAspNetCoreModule
的 PostInitialize()
中调用。
因此AbpAspNetCoreModule
的方法AddApplicationParts
中使用的ControllerAssemblySettings
已经包含了所有要通过ApplicationPartManager
理解为什么AbpUserConfigurationController
没有大摇大摆地出现-ui
简而言之,常规路由不被Swagger
支持,参见swashbuckle-apiexplorer-and-routing。
TokenAuthController
出现在 swagger-ui
是因为它装饰有 [Route("api/[controller]/[action]")]
(属性路由)