Thank you Krzysztof!! I read all your post about dynproxy. I will generate a test case.
This solution doesn't work for me : var target = (invocation.Proxy as IProxyTargetAccessor).DynProxyGetTarget(); (invocation as IChangeProxyTarget).ChangeInvocationTarget(target); invocation.Proceed(); It give me a System.InvalidCastException cannot convert from "ObjectA" to "IC". (remember, ObjectA only implements IA) Krzysztof Kozmic escribió: > José, > > As for the additional interceptor, use it to switch the target of > invocation to proxy target instead of proxy itself. > > var target = (invocation.Proxy as > IProxyTargetAccessor).DynProxyGetTarget(); > (invocation as IChangeProxyTarget).ChangeInvocationTarget(target); > invocation.Proceed(); > > this should set you up until we get a proper fix for that. > > Krzysztof > > > > On Jul 6, 8:08 am, Krzysztof Koźmic <[email protected]> > wrote: > >> José, >> >> I only have a brief moment, so I can't verify the actual behavior, but >> here's what I *think* it may be. >> >> It looks like the fact that IC implements IA takes precedense over the >> fact that you're implementing proxy for IA in the first place, so the >> proxy treats IA as an additional interface, instead of target interface. >> The fact that you get proxy as a target is explained >> here:http://kozmic.pl/archive/2009/07/01/castle-dynamic-proxy-tutorial-par... >> >> My workaround would be to insert additional interceptor that would take >> the target of proxy (invocation.Proxy as >> IProxyTargetAccessor).GetProxyTarget() and invoke method directly. >> >> It seems like it's part of a larger >> bug:http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPRO... >> >> Please create a testcase and attach it to the issue. >> >> Krzysztof >> >> José F. Romaniello pisze: >> >> >>> I want a proxy with a target of the following scenrario: >>> >>> I have three interfaces : >>> -IA >>> -IB >>> -IC : IA, IB --> (IC inherit IA and IB) >>> >>> The target is an implementation of "IA" and I want the proxy implements >>> IC and IB of course. >>> >>> proxyGenerator.CreateInterfaceProxyWithTargetInterface(typeof(IA), >>> new[] { typeof(IC) }, >>> //Aditional interfaces. >>> anInstanceImplementingIA, options, >>> new[] { new SampleInterceptor() }); >>> >>> The problem; If I do it in this way calls to members of "IA" never >>> reached the target. >>> The InvocationTarget of those members is the Proxy, instead >>> "anInstanceImplementingIA". >>> >>> Thanks. >>> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
