예제 #1
0
 public void ShouldBeCreateableWithHandlers()
 {
     IUnityContainer container = GetContainer();
     PolicySet policies = GetPolicies(container);
     HandlerPipeline pipeline 
         = new HandlerPipeline(policies.GetHandlersFor(GetTargetMemberInfo(), container));
 }
예제 #2
0
        public MessagingRoot(MessagingSerializationGraph serialization,
                             JasperOptions settings,
                             HandlerGraph handlers,
                             IDurableMessagingFactory factory,
                             ISubscriberGraph subscribers,
                             IMessageLogger messageLogger,
                             IContainer container,
                             ITransportLogger transportLogger)
        {
            Settings         = settings;
            _handlers        = handlers;
            _transportLogger = transportLogger;
            Factory          = factory;
            Subscribers      = subscribers;
            Transports       = container.QuickBuildAll <ITransport>().ToArray();


            Serialization = serialization;

            Logger = messageLogger;

            Pipeline = new HandlerPipeline(Serialization, handlers, Logger,
                                           container.QuickBuildAll <IMissingHandler>(),
                                           this);

            Workers = new WorkerQueue(Logger, Pipeline, settings);

            Router = new MessageRouter(this, handlers);

            // TODO -- ZOMG this is horrible, and I admit it.
            if (Factory is NulloDurableMessagingFactory f)
            {
                f.ScheduledJobs = ScheduledJobs;
            }
        }
예제 #3
0
 public void ShouldBeCreateableWithHandlers()
 {
     IUnityContainer container = GetContainer();
     PolicySet       policies  = GetPolicies(container);
     HandlerPipeline pipeline
         = new HandlerPipeline(policies.GetHandlersFor(GetTargetMemberInfo(), container));
 }
예제 #4
0
        public MessagingRoot(MessagingSerializationGraph serialization,
                             JasperOptions options,
                             HandlerGraph handlers,
                             ISubscriberGraph subscribers,
                             IMessageLogger messageLogger,
                             IContainer container,
                             ITransportLogger transportLogger
                             )
        {
            Options          = options;
            Handlers         = handlers;
            _transportLogger = transportLogger;
            Subscribers      = subscribers;
            Transports       = container.QuickBuildAll <ITransport>().ToArray();


            Serialization = serialization;

            Logger = messageLogger;

            Pipeline = new HandlerPipeline(Serialization, handlers, Logger,
                                           container.QuickBuildAll <IMissingHandler>(),
                                           this);

            Workers = new WorkerQueue(Logger, Pipeline, options);

            Router = new MessageRouter(this, handlers);

            _persistence = new Lazy <IEnvelopePersistence>(() => container.GetInstance <IEnvelopePersistence>());
        }
        public void ThrowingFromInterceptedMethodStillRunsAllHandlers()
        {
            MethodInfo           thrower  = typeof(ClassWithDefaultCtor).GetMethod("NotImplemented");
            ClassWithDefaultCtor instance = WireupHelper.GetInterceptingInstance <ClassWithDefaultCtor>();
            IInterceptingProxy   pm       = (IInterceptingProxy)instance;

            CallCountHandler     handler     = new CallCountHandler();
            PostCallCountHandler postHandler = new PostCallCountHandler();
            HandlerPipeline      pipeline    = new HandlerPipeline(new ICallHandler[] { postHandler, handler });
            PipelineManager      manager     = new PipelineManager();

            manager.SetPipeline(thrower, pipeline);
            pm.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));

            try
            {
                instance.NotImplemented();
                Assert.Fail("Should have thrown before getting here");
            }
            catch (NotImplementedException)
            {
                // We're expecting this one
            }

            Assert.AreEqual(1, handler.CallCount);
            Assert.AreEqual(1, postHandler.CallsCompleted);
        }
예제 #6
0
        private void SetPipeline(PipelineManager manager, object instance, string methodName, params ICallHandler[] handlers)
        {
            HandlerPipeline    pipeline     = new HandlerPipeline(handlers);
            MethodInfo         targetMethod = instance.GetType().BaseType.GetMethod(methodName);
            IInterceptingProxy proxy        = (IInterceptingProxy)instance;

            manager.SetPipeline(targetMethod, pipeline);
        }
예제 #7
0
 private void ApplyPolicies(IInterceptor interceptor, IInterceptingProxy proxy, object target, PolicySet policies)
 {
     foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(target.GetType(), target.GetType()))
     {
         HandlerPipeline pipeline = new HandlerPipeline(policies.GetHandlersFor(method, container));
         proxy.SetPipeline(method.ImplementationMethodInfo, pipeline);
     }
 }
예제 #8
0
 private void AddHandlersForType(Type classToProxy, PolicySet policies)
 {
     foreach (MethodInfo member in classToProxy.GetMethods())
     {
         IEnumerable <ICallHandler> handlers = policies.GetHandlersFor(member);
         HandlerPipeline            pipeline = new HandlerPipeline(handlers);
         memberHandlers[member] = pipeline;
     }
 }
예제 #9
0
        public void CanAddHandlersToPipeline()
        {
            MethodInfo           methodOne = typeof(ClassWithDefaultCtor).GetMethod("MethodOne");
            ClassWithDefaultCtor instance  = WireupHelper.GetInterceptingInstance <ClassWithDefaultCtor>();
            IInterceptingProxy   pm        = (IInterceptingProxy)instance;

            CallCountHandler handler = new CallCountHandler();

            HandlerPipeline pipeline = new HandlerPipeline(new CallCountHandler[] { handler });

            pm.SetPipeline(methodOne, pipeline);
        }
예제 #10
0
        public override string Reverse <TItem>(TItem obj)
        {
            HandlerPipeline         pipeline = ((IInterceptingProxy)this).GetPipeline(reverse);
            VirtualMethodInvocation inputs   = new VirtualMethodInvocation(this, reverse, obj);
            IMethodReturn           result   = pipeline.Invoke(inputs, Reverse_DelegateImpl <TItem>);

            if (result.Exception != null)
            {
                throw result.Exception;
            }
            return((string)result.ReturnValue);
        }
예제 #11
0
        private void ApplyPolicies(IInterceptor interceptor, IInterceptingProxy proxy, object target, PolicySet policies)
        {
            PipelineManager manager = new PipelineManager();

            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(target.GetType(), target.GetType()))
            {
                HandlerPipeline pipeline = new HandlerPipeline(policies.GetHandlersFor(method, container));
                manager.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }

            proxy.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));
        }
예제 #12
0
        public override void OutParams(int x, out int plusOne, out int timesTwo)
        {
            HandlerPipeline         pipeline = ((IInterceptingProxy)this).GetPipeline(outParams);
            VirtualMethodInvocation inputs   = new VirtualMethodInvocation(this, outParams, x, default(int), default(int));
            IMethodReturn           result   = pipeline.Invoke(inputs, OutParams_Delegate);

            if (result.Exception != null)
            {
                throw result.Exception;
            }
            plusOne  = (int)result.Outputs[0];
            timesTwo = (int)result.Outputs[1];
        }
예제 #13
0
        public override int MethodWithRefParameters(int x, ref string y, float f)
        {
            HandlerPipeline         pipeline = ((IInterceptingProxy)this).GetPipeline(methodWithRefParameters);
            VirtualMethodInvocation inputs   = new VirtualMethodInvocation(this, methodWithRefParameters, x, y, f);
            IMethodReturn           result   = pipeline.Invoke(inputs, MethodWithRefParameters_Delegate);

            if (result.Exception != null)
            {
                throw result.Exception;
            }
            y = (string)result.Outputs[0];
            return((int)result.ReturnValue);
        }
예제 #14
0
        SignatureTestTarget GetTarget()
        {
            TransparentProxyInterceptor interceptor = new TransparentProxyInterceptor();
            PolicySet           policySet           = GetPolicies();
            SignatureTestTarget target = new SignatureTestTarget();
            IInterceptingProxy  proxy  = interceptor.CreateProxy(typeof(SignatureTestTarget), target);

            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(typeof(SignatureTestTarget), typeof(SignatureTestTarget)))
            {
                HandlerPipeline pipeline = new HandlerPipeline(
                    policySet.GetHandlersFor(method, container));
                proxy.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }
            return((SignatureTestTarget)proxy);
        }
예제 #15
0
        public void CallingMethodInvokesHandlers()
        {
            MethodInfo           methodOne = typeof(ClassWithDefaultCtor).GetMethod("MethodOne");
            ClassWithDefaultCtor instance  = WireupHelper.GetInterceptingInstance <ClassWithDefaultCtor>();
            IInterceptingProxy   pm        = (IInterceptingProxy)instance;

            CallCountHandler     handler     = new CallCountHandler();
            PostCallCountHandler postHandler = new PostCallCountHandler();
            HandlerPipeline      pipeline    = new HandlerPipeline(new ICallHandler[] { postHandler, handler });

            pm.SetPipeline(methodOne, pipeline);

            instance.MethodOne();

            Assert.AreEqual(1, handler.CallCount);
            Assert.AreEqual(1, postHandler.CallsCompleted);
        }
예제 #16
0
        public MessagingRoot(ObjectPoolProvider pooling,
                             MessagingSettings settings,
                             HandlerGraph handlers,
                             Forwarders forwarders,
                             IDurableMessagingFactory factory,
                             IChannelGraph channels,
                             ISubscriptionsRepository subscriptions,
                             IMessageLogger messageLogger,
                             IEnumerable <ISerializerFactory> serializers,
                             IEnumerable <IMessageDeserializer> readers,
                             IEnumerable <IMessageSerializer> writers,
                             ITransport[] transports,
                             IEnumerable <IMissingHandler> missingHandlers,
                             IEnumerable <IUriLookup> lookups, ITransportLogger transportLogger)
        {
            Settings         = settings;
            _handlers        = handlers;
            _transportLogger = transportLogger;
            Replies          = new ReplyWatcher();
            Factory          = factory;
            Channels         = channels;
            Transports       = transports;



            Lookup = new UriAliasLookup(lookups);


            Serialization = new MessagingSerializationGraph(pooling, settings, handlers, forwarders, serializers,
                                                            readers, writers);

            Logger = messageLogger;

            Pipeline = new HandlerPipeline(Serialization, handlers, Replies, Logger, missingHandlers,
                                           this);

            Workers = new WorkerQueue(Logger, Pipeline, settings);

            Router = new MessageRouter(Serialization, channels, subscriptions, handlers, Logger, Lookup, settings);

            // TODO -- ZOMG this is horrible, and I admit it.
            if (Factory is NulloDurableMessagingFactory)
            {
                Factory.As <NulloDurableMessagingFactory>().ScheduledJobs = ScheduledJobs;
            }
        }
예제 #17
0
        public void ShouldBeInvokable()
        {
            PolicySet       policies = GetPolicies();
            HandlerPipeline pipeline =
                new HandlerPipeline(policies.GetHandlersFor(GetTargetMemberInfo()));

            IMethodReturn result = pipeline.Invoke(
                MakeCallMessage(),
                delegate(IMethodInvocation message, GetNextHandlerDelegate getNext)
            {
                return(MakeReturnMessage(message));
            });

            Assert.IsNotNull(result);
            Assert.AreEqual(1, callCountHandler.CallCount);
            Assert.AreEqual(returnHandler.ValueToRewriteTo, (string)result.ReturnValue);
        }
        SignatureTestTarget GetTarget()
        {
            TransparentProxyInterceptor interceptor = new TransparentProxyInterceptor();
            PolicySet policySet = GetPolicies();
            SignatureTestTarget target = new SignatureTestTarget();
            IInterceptingProxy proxy = interceptor.CreateProxy(typeof(SignatureTestTarget), target);

            PipelineManager manager = new PipelineManager();
            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(typeof(SignatureTestTarget), typeof(SignatureTestTarget)))
            {
                HandlerPipeline pipeline = new HandlerPipeline(
                    policySet.GetHandlersFor(method, container));
                manager.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }
            proxy.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));

            return (SignatureTestTarget)proxy;
        }
예제 #19
0
        public void ShouldBeInvokable()
        {
            IUnityContainer container = GetContainer();
            PolicySet policies = GetPolicies(container);
            HandlerPipeline pipeline 
                = new HandlerPipeline(policies.GetHandlersFor(GetTargetMemberInfo(), container));

            IMethodReturn result = pipeline.Invoke(
                MakeCallMessage(),
                delegate(IMethodInvocation message,
                         GetNextHandlerDelegate getNext)
                {
                    return MakeReturnMessage(message);
                });
            Assert.IsNotNull(result);
            Assert.AreEqual(1, callCountHandler.CallCount);
            Assert.AreEqual(returnHandler.ValueToRewriteTo, (string)result.ReturnValue);
        }
예제 #20
0
        private ISignatureTestTarget GetTarget()
        {
            var                interceptor = new InterfaceInterceptor();
            PolicySet          policySet   = GetPolicies();
            var                target      = new SignatureTestTarget();
            IInterceptingProxy proxy       = interceptor.CreateProxy(typeof(ISignatureTestTarget), target);

            PipelineManager manager = new PipelineManager();

            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(typeof(ISignatureTestTarget), typeof(SignatureTestTarget)))
            {
                HandlerPipeline pipeline = new HandlerPipeline(
                    policySet.GetHandlersFor(method, container));
                manager.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }
            proxy.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));

            return((ISignatureTestTarget)proxy);
        }
예제 #21
0
        public void ProxyMapsInterfaceMethodsToTheirImplementations()
        {
            MethodInfo something     = typeof(InterfaceOne).GetMethod("Something");
            MethodInfo somethingImpl = typeof(MBROWithInterface).GetMethod("Something");

            CallCountHandler handler = new CallCountHandler();

            MBROWithInterface original    = new MBROWithInterface();
            MBROWithInterface intercepted = new InterceptingRealProxy(original, typeof(MBROWithOneMethod))
                                            .GetTransparentProxy() as MBROWithInterface;

            HandlerPipeline    pipeline = new HandlerPipeline(Seq.Collect <ICallHandler>(handler));
            IInterceptingProxy proxy    = (IInterceptingProxy)intercepted;

            proxy.SetPipeline(something, pipeline);
            HandlerPipeline implPipeline = proxy.GetPipeline(somethingImpl);

            Assert.AreSame(pipeline, implPipeline);
        }
예제 #22
0
        public MessagingRoot(
            ObjectPoolProvider pooling,
            BusSettings settings,
            HandlerGraph handlers,
            Forwarders forwarders,
            IPersistence persistence,
            IChannelGraph channels,
            ISubscriptionsRepository subscriptions,
            IEnumerable <ISerializerFactory> serializers,
            IEnumerable <IMessageDeserializer> readers,
            IEnumerable <IMessageSerializer> writers,
            IMessageLogger[] loggers,
            ITransport[] transports,
            IEnumerable <IMissingHandler> missingHandlers,
            IEnumerable <IUriLookup> lookups)
        {
            _settings    = settings;
            _handlers    = handlers;
            _replies     = new ReplyWatcher();
            _persistence = persistence;
            _channels    = channels;
            _transports  = transports;



            Lookup = new UriAliasLookup(lookups);


            Serialization = new BusMessageSerializationGraph(pooling, settings, handlers, forwarders, serializers,
                                                             readers, writers);

            Logger = new CompositeMessageLogger(loggers);

            Pipeline = new HandlerPipeline(Serialization, handlers, _replies, Logger, missingHandlers,
                                           new Lazy <IServiceBus>(Build));

            Workers = new WorkerQueue(Logger, Pipeline, settings);

            Router = new MessageRouter(Serialization, channels, subscriptions, handlers, Logger, Lookup, settings);

            ScheduledJobs = new InMemoryScheduledJobProcessor();
        }
예제 #23
0
        public MessagingRoot(
            MessagingSerializationGraph serialization,
            MessagingSettings settings,
            HandlerGraph handlers,
            IDurableMessagingFactory factory,
            IChannelGraph channels,
            ISubscriptionsRepository subscriptions,
            IMessageLogger messageLogger,
            Lamar.IContainer container,
            ITransportLogger transportLogger)
        {
            Settings         = settings;
            _handlers        = handlers;
            _transportLogger = transportLogger;
            Replies          = new ReplyWatcher();
            Factory          = factory;
            Channels         = channels;
            Transports       = container.QuickBuildAll <ITransport>().ToArray();



            Lookup = new UriAliasLookup(container.QuickBuildAll <IUriLookup>());


            Serialization = serialization;

            Logger = messageLogger;

            Pipeline = new HandlerPipeline(Serialization, handlers, Replies, Logger, container.QuickBuildAll <IMissingHandler>(),
                                           this);

            Workers = new WorkerQueue(Logger, Pipeline, settings);

            Router = new MessageRouter(Serialization, channels, subscriptions, handlers, Logger, Lookup, settings);

            // TODO -- ZOMG this is horrible, and I admit it.
            if (Factory is NulloDurableMessagingFactory f)
            {
                f.ScheduledJobs = ScheduledJobs;
            }
        }
예제 #24
0
        public override string AddUp(int x, int y)
        {
            HandlerPipeline         pipeline = ((IInterceptingProxy)this).GetPipeline(addUp);
            VirtualMethodInvocation inputs   = new VirtualMethodInvocation(this, addUp, x, y);
            IMethodReturn           result   = pipeline.Invoke(inputs, delegate(IMethodInvocation input, GetNextHandlerDelegate getNext)
            {
                try
                {
                    string returnValue = BaseAddUp((int)input.Inputs[0], (int)input.Inputs[1]);
                    return(input.CreateMethodReturn(returnValue, input.Inputs[0], input.Inputs[1]));
                }
                catch (Exception ex)
                {
                    return(input.CreateExceptionMethodReturn(ex));
                }
            });

            if (result.Exception != null)
            {
                throw result.Exception;
            }
            return((string)result.ReturnValue);
        }
예제 #25
0
        public override void MethodOne()
        {
            HandlerPipeline pipeline = ((IInterceptingProxy)this).GetPipeline(methodOne);

            VirtualMethodInvocation inputs = new VirtualMethodInvocation(this, methodOne);
            IMethodReturn           result = pipeline.Invoke(inputs, delegate(IMethodInvocation input, GetNextHandlerDelegate getNext)
            {
                try
                {
                    BaseMethodOne();
                    return(input.CreateMethodReturn(null, input.Arguments));
                }
                catch (Exception ex)
                {
                    return(input.CreateExceptionMethodReturn(ex));
                }
            });

            if (result.Exception != null)
            {
                throw result.Exception;
            }
        }
예제 #26
0
        /// <summary>
        /// Applies the policy injection handlers configured for the invoked method.
        /// </summary>
        /// <param name="input">Inputs to the current call to the target.</param>
        /// <param name="getNext">Delegate to execute to get the next delegate in the handler
        /// chain.</param>
        /// <returns>Return value from the target.</returns>
        public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext)
        {
            Guard.ArgumentNotNull(input, "input");
            Guard.ArgumentNotNull(getNext, "getNext");

            HandlerPipeline pipeline = GetPipeline(input.MethodBase);

            return(pipeline.Invoke(
                       input,
                       delegate(IMethodInvocation policyInjectionInput, GetNextHandlerDelegate policyInjectionInputGetNext)
            {
                try
                {
                    return getNext()(policyInjectionInput, getNext);
                }
                catch (TargetInvocationException ex)
                {
                    // The outer exception will always be a reflection exception; we want the inner, which is
                    // the underlying exception.
                    return policyInjectionInput.CreateExceptionMethodReturn(ex.InnerException);
                }
            }));
        }
예제 #27
0
        /// <summary>
        /// Executes a method call represented by the <paramref name="msg"/>
        /// parameter. The CLR will call this method when a method is called
        /// on the TransparentProxy. This method runs the invocation through
        /// the call handler pipeline and finally sends it down to the
        /// target object, and then back through the pipeline.
        /// </summary>
        /// <param name="msg">An <see cref="IMessage"/> object that contains the information
        /// about the method call.</param>
        /// <returns>An <see cref="RemotingMethodReturn"/> object contains the
        /// information about the target method's return value.</returns>
        public override IMessage Invoke(IMessage msg)
        {
            IMethodCallMessage callMessage = (IMethodCallMessage)msg;

            HandlerPipeline pipeline;

            if (memberHandlers.ContainsKey(callMessage.MethodBase))
            {
                pipeline = memberHandlers[callMessage.MethodBase];
            }
            else
            {
                pipeline = new HandlerPipeline();
            }

            RemotingMethodInvocation invocation = new RemotingMethodInvocation(callMessage, target);
            IMethodReturn            result     =
                pipeline.Invoke(
                    invocation,
                    delegate(IMethodInvocation input, GetNextHandlerDelegate getNext)
            {
                try
                {
                    object returnValue = callMessage.MethodBase.Invoke(target, invocation.Arguments);
                    return(input.CreateMethodReturn(returnValue, invocation.Arguments));
                }
                catch (TargetInvocationException ex)
                {
                    // The outer exception will always be a reflection exception; we want the inner, which is
                    // the underlying exception.
                    return(input.CreateExceptionMethodReturn(ex.InnerException));
                }
            });

            return(((RemotingMethodReturn)result).ToMethodReturnMessage());
        }
예제 #28
0
        public override int CalculateAnswer()
        {
            HandlerPipeline         pipeline = ((IInterceptingProxy)this).GetPipeline(calculateAnswer);
            VirtualMethodInvocation inputs   = new VirtualMethodInvocation(this, calculateAnswer);
            IMethodReturn           result   = pipeline.Invoke(inputs, delegate(IMethodInvocation input, GetNextHandlerDelegate getNext)
            {
                try
                {
                    int returnValue = BaseCalculateAnswer();
                    return(input.CreateMethodReturn(returnValue, input.Arguments));
                }
                catch (Exception ex)
                {
                    return(input.CreateExceptionMethodReturn(ex));
                }
            });

            if (result.Exception != null)
            {
                throw result.Exception;
            }

            return((int)result.ReturnValue);
        }
예제 #29
0
            public void TargetMethod()
            {
                MethodInfo targetMethod = typeof(IInterfaceOne).GetMethod("TargetMethod");

                VirtualMethodInvocation input         = new VirtualMethodInvocation(target, targetMethod);
                HandlerPipeline         pipeline      = ((IInterceptingProxy)this).GetPipeline(targetMethod);
                IMethodReturn           returnMessage = pipeline.Invoke(input, delegate(IMethodInvocation inputs, GetNextHandlerDelegate getNext)
                {
                    try
                    {
                        target.TargetMethod();
                        return(inputs.CreateMethodReturn(null));
                    }
                    catch (Exception ex)
                    {
                        return(inputs.CreateExceptionMethodReturn(ex));
                    }
                });

                if (returnMessage.Exception != null)
                {
                    throw returnMessage.Exception;
                }
            }
예제 #30
0
 public TestEnvelopeContext() : this(MockRepository.GenerateMock <IHandlerPipeline>())
 {
     HandlerPipeline.Stub(x => x.Invoke(null, null)).IgnoreArguments().Return(Task.CompletedTask);
 }
예제 #31
0
 public void ShouldBeCreatable()
 {
     HandlerPipeline pipeline = new HandlerPipeline();
 }
        private void SetPipeline(PipelineManager manager, object instance, string methodName, params ICallHandler[] handlers)
        {
            HandlerPipeline pipeline = new HandlerPipeline(handlers);
            MethodInfo targetMethod = instance.GetType().BaseType.GetMethod(methodName);
            IInterceptingProxy proxy = (IInterceptingProxy)instance;
            manager.SetPipeline(targetMethod, pipeline);

        }
예제 #33
0
 void IInterceptingProxy.SetPipeline(MethodBase method, HandlerPipeline pipeline)
 {
     pipelines.SetPipeline(method.MetadataToken, pipeline);
 }
예제 #34
0
 public void ShouldBeCreateableWithHandlers()
 {
     PolicySet       policies = GetPolicies();
     HandlerPipeline pipeline =
         new HandlerPipeline(policies.GetHandlersFor(GetTargetMemberInfo()));
 }
예제 #35
0
 public void ShouldBeCreatable()
 {
     HandlerPipeline pipeline = new HandlerPipeline();
 }
        private void ApplyPolicies(IInterceptor interceptor, IInterceptingProxy proxy, object target, PolicySet policies)
        {
            PipelineManager manager = new PipelineManager();

            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(target.GetType(), target.GetType()))
            {
                HandlerPipeline pipeline = new HandlerPipeline(policies.GetHandlersFor(method, container));
                manager.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }

            proxy.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));
        }