use MethodInvocationTarget

On Tue, Sep 27, 2011 at 7:32 AM, leo <[email protected]> wrote:
> Hi,
>
> I'm using interceptors for caching some wrappers responses.
> I'd like to exclude one method from this mechanism, so I've decorated
> that method with a .NET  attribute I've defined.
>
> Whene my CacheInterceptor intercept my calls I check if the method
> called is to exclude from the cache mechanism in that way:
>
> var notToCache = invocation.Method.GetCustomAttributes(typeof
> (NoCache), true).Count() != 0;
>
> that code doesn't work - the method seems to not have been tagged.
>
> I've found as workaround this code:
>
> var notToCache = invocation.TargetType.GetMethods().First(m => m.Name
> == method.Name).GetCustomAttributes(typeof (NoCache), true).Count() !=
> 0;
>
> that works...
> but the problem in this case is when the method called has one or more
> overloads....
> How can I do?
>
> regards
> leo
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Development List" 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-devel?hl=en.
>
>



-- 
Cheers,
hammett
http://hammett.castleproject.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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-devel?hl=en.

Reply via email to