[英]Registeting interceptors after Component registration in Castle
I have a facility which needs to register an interceptor and then register this interceptor against a subset of the components already registerd in the container Castle Kernel. 我有一个设施,需要注册一个拦截器,然后针对已经在容器Castle Kernel中注册的组件的子集注册此拦截器。
The facility lives in a separatee assembly and it is meant to be used from different assemblies so I cannot couple the interceptor registration with the component registration of each assembly that uses this facility. 该工具位于单独的程序集中,并且打算在不同的程序集中使用,因此我无法将拦截器注册与使用此工具的每个程序集的组件注册耦合。
Is it possible to do this? 是否有可能做到这一点? How can I achieve this functionality?
如何实现此功能?
Normally the way I use facilities is like this: 通常,我使用设施的方式是这样的:
// 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());
The facilities usually either subscribe to container events , register some of their own components, or add ComponentModel
construction contributors that examine and augment ComponentModel
of components being registered. 这些设施通常订阅容器事件 ,注册其自己的某些组件或添加
ComponentModel
构造贡献者 ,以检查和扩充正在注册的ComponentModel
。
That way it can be completely transparent to components and imposes to explicit coupling between components and facility (unless you want it). 这样,它对组件是完全透明的,并强加了组件和设施之间的显式耦合(除非您需要)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.