Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.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
.net StructureMap拦截器和DynamicProxy_.net_Aop_Structuremap_Dynamic Proxy - Fatal编程技术网

.net StructureMap拦截器和DynamicProxy

.net StructureMap拦截器和DynamicProxy,.net,aop,structuremap,dynamic-proxy,.net,Aop,Structuremap,Dynamic Proxy,我正在尝试将StructureMap从2.6升级到4.7。我有一个创建并返回代理的拦截器 public object Process(object target, IContext context) { Type targetType = target.GetType(); var instanceRef = _container.Model.AllInstances.FirstOrDefault(e => e.ReturnedType =

我正在尝试将StructureMap从2.6升级到4.7。我有一个创建并返回代理的拦截器

    public object Process(object target, IContext context)
    {
        Type targetType = target.GetType();

        var instanceRef = _container.Model.AllInstances.FirstOrDefault(e => e.ReturnedType == targetType);

        if (instanceRef != null)
        {
            Type interfaceToProxy = instanceRef.PluginType;
            return _proxyGenerator.CreateInterfaceProxyWithTargetInterface(interfaceToProxy, target, new[] { (IInterceptor) new AspectInterceptor(_aspectConfiguration) });
        }

        return target;
    }

    public bool MatchesType(Type type)
    {
        object[] customAttributes = type.GetCustomAttributes(typeof (EnableAspects), true);

        return customAttributes.Length > 0;
    }
我如何重构它以使其在StructureMap 4.7上工作