Domanda

Ho un impianto che ha bisogno di registrare un intercettore e quindi registrare quest'interceptor contro un sottoinsieme dei componenti già registerd nel contenitore Castello Kernel.

La struttura vive in un separatee di montaggio ed è pensato per essere utilizzato da diversi assemblee in modo da non posso accoppiare la registrazione intercettore con la registrazione del componente di ogni gruppo che usi questa struttura.

E 'possibile fare questo? Come posso ottenere questa funzionalità?

È stato utile?

Soluzione

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).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top