城堡中的组件注册后注册拦截器
问题描述:
我有一个工具需要注册一个拦截器,然后将这个拦截器注册到 已注册到容器Castle Kernel中的子集。城堡中的组件注册后注册拦截器
该设施住在separatee组件和它的目的是从不同的 组件中使用,所以我不能夫妇与组件注册使用该设施的每个组件的 拦截器注册。
可以做到这一点吗? 我该如何实现此功能?
答
通常我使用设施的方法是这样的:
// 1. create the container
var container = new WindsorContainer();
// 2. add all the facilities I need
container.AddFacility<SomeFacility>();
contianer.AddFacility<SomeOtherFacility>();
// 3. install all the components
container.Install(FromAssembly.This());
这些设施通常要么订阅container events,注册了自己的一些成分,或添加ComponentModel
construction contributors是检查和加强部件ComponentModel
被注册。
这样它可以完全透明的组件和施加组件和设施之间的显式耦合(除非你想要它)。
谢谢你,我只是发现贡献者。我不知道他们存在! – angrifel