/// <summary> /// Initializes a new instance of the <see cref="UnityInjectionBehavior" /> with the given information /// about what's being intercepted and the current set of injection policies. /// </summary> /// <param name="interceptionRequest">Information about what will be injected.</param> /// <param name="container">Service container that can be used to resolve interceptors.</param> public UnityInjectionBehavior(CurrentInterceptionRequest interceptionRequest, IServiceContainer container) { if (interceptionRequest == null) { throw new ArgumentNullException(nameof(interceptionRequest)); } var hasHandlers = false; var manager = new PipelineManager(); foreach ( var method in interceptionRequest.Interceptor.GetInterceptableMethods(interceptionRequest.TypeToIntercept, interceptionRequest.ImplementationType)) { var hasNewHandlers = manager.InitializePipeline(method.InterfaceMethodInfo, method.ImplementationMethodInfo, container); hasHandlers = hasHandlers || hasNewHandlers; } _pipelineManager = hasHandlers ? manager : null; }
/// <summary> /// Initializes a new instance of the <see cref="UnityInjectionBehavior" /> with a pipeline manager. /// </summary> /// <param name="pipelineManager"> /// The <see cref="PipelineManager" /> for /// the new instance. /// </param> internal UnityInjectionBehavior(PipelineManager pipelineManager) { _pipelineManager = pipelineManager; }