Now i'm confused ;) Did you think i called the MethodInfo.Invoke from  
inside the intercepto? No, no i didn't. That this results in an  
endless loop is clear. I did simply:
Obj = CreateInterfacProxyWithTarget
pMethod.Invoke(obj...)

And Inside the interceptor:

...
If( check(...))
   invocation.proceed()

This leads to a StackOverflow...

Am 25.06.2009 um 16:09 schrieb Ayende Rahien <[email protected]>:

> It _is_, from the OUTSIDE.
> You are calling this from the intereceptor!
>
> On Thu, Jun 25, 2009 at 5:03 PM, Belvasis  
> <[email protected]> wrote:
> No thats not what i want or need :( I thought it would be completely  
> transparent for the user of the object if it i proxied or not. This  
> is true if you work with the public signature of the object, but not  
> if you use reflection as far as i can see.  I wanted the developer  
> to call something like TaskRegistry.invokeTask("taskDef"). In the  
> end this builds a stateless Task object. Every method of the Task  
> can be decorated with an TaskImplementor("taskDef") Attribute and  
> those methods should be intercepted to check availability,  
> permission etc., if the are invoked. So i have to use reflection for  
> it. Maybe i have to think about other ways to do this.
>
> Regards
>
>
> Am 25.06.2009 um 10:01 schrieb Ayende Rahien <[email protected]>:
>
>> Yes, that is what you want, no?
>>
>> On Thu, Jun 25, 2009 at 10:50 AM, Belvasis <[email protected] 
>> > wrote:
>> But if i invoke the method on the DynProxyGetTarget() - object it  
>> bypasses the interceptor, or do Ido something wrong? On the other  
>> hand
>> what you say means, you have alwys to know if an object is a proxy  
>> or not. Is this wanted?
>>
>> Thanks and regards
>>
>> Am 25.06.2009 um 02:01 schrieb Ayende Rahien <[email protected]>:
>>
>>> That is the expected behavior.
>>> Invoking a method using Invoke will mean that you get back to the  
>>> interceptor.
>>> The workaround you specified is how this should work.
>>>
>>> On Thu, Jun 25, 2009 at 2:55 AM, Belvasis <[email protected] 
>>> > wrote:
>>>
>>>
>>>
>>>
>>> >
>>>
>>> > Hi,
>>> > I have the following problem:
>>> > I want to invoke a method on a proxy
>>> > using MethodInfo.Invoke(...). The method should be intercepted,  
>>> if the
>>> > InterceptorSelector decided to do so.
>>> > The problem is, that the Interceptor.Intercept method is called in
>>> > an endless loop, if invocation.Proceed is called Inside the
>>> > interceptor. Anyone an idea why this happend? If i invoke the
>>> > corresponding MethodInfo of the DynProxyGetTarget() - object, it
>>> > works as expected.
>>> >
>>> > Thanks
>>> > Belvasis
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
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