开发者

Castle Windsor Interceptor selectors and hooks

I'm doing some project in Castle Windsor and I have some problems with interceptor hook in config file I created class that impements IProxyGenerationHook:

public c开发者_开发知识库lass LoggingProxyGenerationHook : IProxyGenerationHook
{

    #region IProxyGenerationHook Members

    public void MethodsInspected()
    {
        //throw new Exception("The method or operation is not implemented.");
    }

    public void NonVirtualMemberNotification(Type type, System.Reflection.MemberInfo memberInfo)
    {
        //throw new Exception("The method or operation is not implemented.");
    }

    public bool ShouldInterceptMethod(Type type, System.Reflection.MethodInfo methodInfo)
    {
        return methodInfo.Name.StartsWith("Save", StringComparison.Ordinal);
    }

    #endregion
}

All I want to do is to intercept methods whose name start with "Save" and hook them dynamically in the config file. Also, in config file I have the following:

<component id="LoggingAspect" type="DynamicInterceptor.LoggingAspect, DynamicInterceptor"></component>
<component id="LoggingProxyGenerationHook" type="DynamicInterceptor.LoggingProxyGenerationHook, DynamicInterceptor"></component>
<component id="TestClass1" type="TestClasses.TestClass1, TestClasses">
<interceptors hook ="${LoggingProxyGenerationHook}">
<interceptor>${LoggingAspect}</interceptor>
</interceptors>
</component>

I suppose that I'm doing something wrong in config file. Any ideas?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜