If you have an interface, you must implement all items.

On Sat, Sep 13, 2008 at 12:11 AM, Troy Gould <[EMAIL PROTECTED]> wrote:

>
> I'm a bit confused about IProxyGenerationHook.  Maybe I'm not using it
> correctly (there is zero docs on it), or it's not working correctly?
> I'm using 1.0 Release Candidate 3 - September 20, 2007 from the
> download pages.
>
> I have an Interceptor that I've created.  However, I would like the
> Interceptor to only intercept methods with a specific attribute on
> them.  I was originally doing all of this from the Interceptor itself,
> but then started looking at the ProxyGenerationOptions class.  It
> allows me to specify a IProxyGenerationHook.  So, I implemented the
> following class:
>
>    internal class CacheableMethodHook : IProxyGenerationHook
>    {
>        public bool ShouldInterceptMethod(Type type, MethodInfo
> memberInfo)
>        {
>            object[] customAttributes =
> memberInfo.GetCustomAttributes(typeof (CacheableAttribute), true);
>            return customAttributes.Length > 0;
>        }
>
>        public void NonVirtualMemberNotification(Type type, MemberInfo
> memberInfo)
>        {
>            return;
>        }
>
>        public void MethodsInspected()
>        {
>            return;
>        }
>    }
>
> However, what happens is that I get the following:
> Method 'QueryAll' in type
> 'ISiteDaoProxy46feaa53f3264bc2aa67ff254bb0925e' from assembly
> 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral,
> PublicKeyToken=null' does not have an implementation.
>
> When the ShouldInterceptMethod of CacheableMethodHook runs, it does
> return false for the QueryAll method.  I was expecting that when it
> returns false, the the Interceptor just calls invocation.Proceed()
> automatically.  Is the the intention or have I missed something in the
> use of IProxyGenerationHook?
> >
>

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