/// <summary> /// Initializes a new instance of the <see cref="PolicyInjectionBehavior"/> 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="policies">Current injection policies.</param> /// <param name="container">Unity container that can be used to resolve call handlers.</param> public PolicyInjectionBehavior(CurrentInterceptionRequest interceptionRequest, InjectionPolicy[] policies, IUnityContainer container) { var allPolicies = new PolicySet(policies); bool hasHandlers = false; var manager = new PipelineManager(); foreach (MethodImplementationInfo method in interceptionRequest.Interceptor.GetInterceptableMethods( interceptionRequest.TypeToIntercept, interceptionRequest.ImplementationType)) { bool hasNewHandlers = manager.InitializePipeline(method, allPolicies.GetHandlersFor(method, container)); hasHandlers = hasHandlers || hasNewHandlers; } pipelineManager = hasHandlers ? manager : null; }
/// <summary> /// Initializes a new instance of the <see cref="PolicyInjectionBehavior"/> with a pipeline manager. /// </summary> /// <param name="pipelineManager">The <see cref="PipelineManager"/> for the new instance.</param> public PolicyInjectionBehavior(PipelineManager pipelineManager) { this.pipelineManager = pipelineManager; }