コード例 #1
0
 public void ShouldBeCreateableWithHandlers()
 {
     IUnityContainer container = GetContainer();
     PolicySet policies = GetPolicies(container);
     HandlerPipeline pipeline 
         = new HandlerPipeline(policies.GetHandlersFor(GetTargetMemberInfo(), container));
 }
コード例 #2
0
ファイル: MessagingRoot.cs プロジェクト: SVemulapalli/jasper
        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>());
        }
コード例 #5
0
        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);
        }
コード例 #18
0
        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
ファイル: MessagingRoot.cs プロジェクト: brokenbot/jasper
        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
ファイル: MessagingRoot.cs プロジェクト: rvanderplaat/jasper
        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();
 }
コード例 #32
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);

        }
コード例 #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();
 }
コード例 #36
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));
        }