private IEnumerable <IInterceptor> HandleInjector(IEnumerable <IInterceptor> interceptors) { foreach (var interceptor in interceptors) { if (PropertyInjectionUtils.Required(interceptor)) { _propertyInjectorFactory.Create(interceptor.GetType()).Invoke(interceptor); } yield return(interceptor); } }
internal static bool RequiredPropertyInjection(this ServiceDefinition serviceDefinition) { if (serviceDefinition is ProxyServiceDefinition proxyServiceDefinition && proxyServiceDefinition.ServiceType.GetTypeInfo().IsInterface) { return(false); } var implType = serviceDefinition.GetImplementationType(); if (implType == null) { return(false); } if (implType == typeof(object)) { return(true); } return(PropertyInjectionUtils.TypeRequired(implType)); }
public IParameterInterceptor[] Select(ParameterInfo parameter) { if (parameter == null) { throw new ArgumentNullException(nameof(parameter)); } return((IParameterInterceptor[])_aspectCaching.GetOrAdd(parameter, info => { var interceptors = ((ParameterInfo)info).GetReflector().GetCustomAttributes().OfType <IParameterInterceptor>().ToArray(); for (var i = 0; i < interceptors.Length; i++) { var interceptor = interceptors[i]; if (PropertyInjectionUtils.Required(interceptor)) { _propertyInjectorFactory.Create(interceptor.GetType()).Invoke(interceptor); } } return interceptors; })); }