I am trying to upgrade StructureMap from 2.6 to 4.7. I had an interceptor which creates and return proxy.
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;
}
How can I refactor this to get it working on StructureMap 4.7