Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 温莎城堡拦截器选择器和挂钩_C#_Castle Windsor_Interceptor_Castle Dynamicproxy - Fatal编程技术网

C# 温莎城堡拦截器选择器和挂钩

C# 温莎城堡拦截器选择器和挂钩,c#,castle-windsor,interceptor,castle-dynamicproxy,C#,Castle Windsor,Interceptor,Castle Dynamicproxy,我在温莎城堡做一些项目,我在配置文件中遇到了一些拦截钩子的问题 我创建了一个类,该类包含IProxyGenerationHook: public class LoggingProxyGenerationHook : IProxyGenerationHook { #region IProxyGenerationHook Members public void MethodsInspected() { //throw new Exception("The

我在温莎城堡做一些项目,我在配置文件中遇到了一些拦截钩子的问题 我创建了一个类,该类包含IProxyGenerationHook

public class 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
}
我所要做的就是截取名称以“Save”开头的方法,并在配置文件中动态地钩住它们。 此外,在配置文件中,我有以下内容:

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

${LoggingAspect}
我想我在配置文件中做错了什么。
有什么想法吗?

那么,什么东西没有按您预期的方式工作?什么意思是没有过滤?是否未调用或忽略其返回值?还是别的什么?如果你想有人帮助你,就要说得更详细些,不要让别人猜。@nikolavas:说这话不公平。Krzysztof在Castle上花费了大量的空闲时间和精力,甚至对Castle文档进行了大量改进。那么,什么东西没有按您预期的方式工作呢?什么意思是没有过滤?是否未调用或忽略其返回值?还是别的什么?如果你想有人帮助你,就要说得更详细些,不要让别人猜。@nikolavas:说这话不公平。Krzysztof在Castle上花费了大量的空闲时间和精力,甚至改进了Castle文档。