Registeting interceptors after Component registration in Castle

456 views Asked by At

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.

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?

1

There are 1 answers

1
Krzysztof Kozmic On BEST ANSWER

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.

That way it can be completely transparent to components and imposes to explicit coupling between components and facility (unless you want it).