反射与 TypeFinder
框架大量使用 ITypeFinder 扫描程序集中的类型(ServiceRegister、RequestPipeline、WorkContext 等)。
TypeFinder 功能
- 按命名规则过滤程序集(
TypeFinderOption.AssemblyMatchRegexPattern)。 - 查找实现特定接口/基类的类型。`
- 配合
Singleton<ITypeFinder>在全局共享,避免重复扫描。
使用场景
- 自动发现
Profile(AutoMapper)。 - 注册
IRequestPiplineRegister、IEndpointConfig、IMvcOptionsConfig。 - 在测试框架中查找 Controller/ViewComponent(参见
AgileLabs.Testing.Web.WebApplicationFactory)。
更多细节可在 AgileLabs.TypeFinders 命名空间查看。