When that runs I end up with a stack overflow, I guess what I need is the
method the interceptor calls for proceed?
I can do it with something like
public class PersonInterceptor : IInterceptor
{
private Person _impl;
public PersonInterceptor(Person impl) {
_impl = impl;
}
public void Intercept(IInvocation invocation)
{
var value = invocation.MethodInvocationTarget.Invoke(impl,
invocation.Arguments);
// Do something with value
}
}
I just thought InvocatgionTarget gave me what I wanted but it seemed I was
totally wrong.
Thanks
2010/9/28 Krzysztof Koźmic <[email protected]>
> what actual value?
>
>
> On 28/09/2010 11:29 AM, Stefan Sedich wrote:
>
>> I am a bit confused about what I thought InvocationTarget returns, say I
>> have the following:
>>
>> public class PersonInterceptor : IInterceptor
>> {
>> public void Intercept(IInvocation invocation)
>> {
>> var value =
>> invocation.MethodInvocationTarget.Invoke(invocation.InvocationTarget,
>> invocation.Arguments);
>>
>> // Do something with value
>> }
>> }
>>
>> var factory = new ProxyGenerator();
>> var proxy = factory.CreateClassProxy<Person>(new PersonInterceptor());
>>
>>
>> The InvocationTarget in the inercept is the proxy itself, not sure if I am
>> just being silly here, but how would I get the actual value like this.
>>
>>
>>
>> Cheers
>> --
>> 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]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>
--
Stefan Sedich
Software Developer
http://weblogs.asp.net/stefansedich
--
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.