Resolvers
可以通过使用sub dependency resovler 重写或扩展默认的组件/依赖解析策略
Resolver怎么工作的
Windsor解析组件时,它会询问所有实现ISubDependencyResovler接口是否可以提供(要解析的)组件
ISubDependencyResolver 接口
Resovlers实现该接口,该接口有两个方法
bool CanResolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency);
object Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency);
将自定义的Resolver插入到Kernel的Sub-Resolver集合:
container.Kernel.Resolver.AddSubResolver(new MyOwnResolver());container.Kernel.Resolver.AddSubResolver(new MyOwnResolver());
标准解析器
Windsor提供了一些Resolver可以插入到容器中使用