Перехватчик StructureMap и DynamicProxy - PullRequest
1 голос
/ 01 апреля 2019

Я пытаюсь обновить 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

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...