Model interceptors selectors are types implementing IModelInterceptorsSelector
interface. They provide custom logic that can modify default set of interceptors associated with the component.
IModelInterceptorsSelector
method's signatures and how it is used have changed.
The IModelInterceptorsSelector
interface exposes two methods:
The method is invoked by the container to learn if given selector is interested in given component. It has the following signature:
bool HasInterceptors(ComponentModel model)
When using the selectors, Windsor will first invoke HasInterceptors
for each of its selectors, and for these of them that return true
it will invoke SelectInterceptors
which performs the actual selection. The method has the following signature:
InterceptorReference[] SelectInterceptors(ComponentModel model, InterceptorReference[] interceptors)
The second argument contains the array of interceptor references returned by previous interceptor in the pipeline. The first interceptor, will receive the default set of interceptors from model.Interceptors
collection. The selector usually will reorder passed interceptors, filter out some of them, or append some more to the collection.
Selectors are attached to ProxyFactory of the kernel, using the following method:
var selector = new MyInterceptorSelector();
container.Kernel.ProxyFactory.AddInterceptorSelector(selector);