I'm currently using Castle Windsor to manage dependencies for my application.
I'm currently using the Classes.FromAssemblyContaining
to register all components of a given type IFoo<>
and would like to register an interceptor for all of these classes.
I can get the interceptor to work when I register individual components like this:
public void SetUpContainer(IWindsorContainer container)
{
container.Register(Component.For<IFoo>()
.ImplementedBy<Foo>()
.LifestyleSingleton().Interceptors<MyIntercepter>());
}
However I would like to keep registering by convention using Classes.FromAssembly. My registration code currently looks something like this:
public void SetUpContainer(IWindsorContainer container)
{
container.Register(Classes.FromAssemblyContaining<Foo>()
.BasedOn(typeof(IFoo<>))
.WithService.Base());
}
How would I add an interceptor for all IFoo<>
's that are registered?