the factory facility bypasses the normal way of creating instances, so by
doing that you're basically preventing windsor from creating a proxy.  what
you wanna try is use kernal.ProxyFactory and create your proxy manually
within the factory delegate/method.

On Wed, Mar 24, 2010 at 2:38 PM, Vinay Mandy <[email protected]> wrote:

> Hello,
>
> I'm having trouble with the following statement:
>
> container.Register(Component.For<ISomeService>().UsingFactoryMethod(()
> => new
>
> SomeServiceImpl(5)).Interceptors(InterceptorReference.ForType<SomeServiceInterceptor>()).First);
>
> whenever I call the 'DoSomething' method on my resolved service, I get
> the following DP error:
>
> System.NotImplementedException: This is a DynamicProxy2 error: the
> interceptor attempted to 'Proceed' for method 'Int32
> DoSomething(Int32)' which has no target. When calling method without
> target there is no implementation to 'proceed' to and it is the
> responsibility of the interceptor to mimic the implementation (set
> return value, out arguments etc)
>
> I noticed that I don't have the problem if I avoid using a factory
> method to create my service, like so:
>
>
> container.Register(Component.For<ISomeService>().ImplementedBy<SomeServiceImpl>().DynamicParameters((kernel,
> parameters) => parameters["param"] =
>
> 5).Interceptors(InterceptorReference.ForType<SomeServiceInterceptor>()).First);
>
> Is there any reason that the first approach wouldn't work or is not
> suggested? Is there an alternative statement that I should use?
>
> Thanks for your help
>
> Vinay
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to