views:

42

answers:

1

I have a WindsorContainer.

I have a ILazyComponentLoader (if it matters) and an Interface (ISomething) with an Interceptor attribute on in.

[Interceptor(typeof(DynamicImplementationInterceptor)]
public interface ISomething

I want Windsor to use ProxyGenerator.CreateInterfaceProxyWithoutTarget when resolving the interface via container.Resolve<ISomething>() so that my DynamicImplementationInterceptor can implement all behavior on demand, externally.

I can't seem to find this exact scenario in the documentation...when I register ISomething by using Component.For<ISomething>()...., how do I specify I want this behavior? (presently I get an error about the type being abstract or interface, so it can't be instantiated...)

Thanks!

+1  A: 

Windsor will automatically omit the target when you register a component with an interceptor and no implementation, e.g.:

var container = new WindsorContainer();
container.Register(Component.For<DynamicImplementationInterceptor>());
container.Register(Component.For<ISomething>()
    .Interceptors(InterceptorReference.ForType<DynamicImplementationInterceptor>()).First);

No need for any Interceptor attribute

Mauricio Scheffer
Cool thanks. I thought I had tried that and gotten something at registration time about the registration needing an implementation, but I will try agian.
JeffN825