示例#1
0
        /// <summary>
        /// Retrieve the pipeline associated with the requested <paramref name="method"/>.
        /// </summary>
        /// <param name="method">The method for which the pipeline is being requested.</param>
        /// <returns>The handler pipeline for the given method. If no pipeline has
        /// been set, returns a new empty pipeline.</returns>
        public HandlerPipeline GetPipeline(MethodBase method)
        {
            HandlerPipelineKey key      = HandlerPipelineKey.ForMethod(method);
            HandlerPipeline    pipeline = EmptyPipeline;

            if (_pipelines.ContainsKey(key))
            {
                pipeline = _pipelines[key];
            }
            return(pipeline);
        }
示例#2
0
        private HandlerPipeline CreatePipeline(MethodInfo method, IEnumerable <ICallHandler> handlers)
        {
            HandlerPipelineKey key = HandlerPipelineKey.ForMethod(method);

            if (_pipelines.ContainsKey(key))
            {
                return(_pipelines[key]);
            }

            if (method.GetBaseDefinition() == method)
            {
                _pipelines[key] = new HandlerPipeline(handlers);
                return(_pipelines[key]);
            }

            var basePipeline = CreatePipeline(method.GetBaseDefinition(), handlers);

            _pipelines[key] = basePipeline;
            return(basePipeline);
        }
示例#3
0
        /// <summary>
        /// Set a new pipeline for a method.
        /// </summary>
        /// <param name="method">The method on which the pipeline should be set.</param>
        /// <param name="pipeline">The new pipeline.</param>
        public void SetPipeline(MethodBase method, HandlerPipeline pipeline)
        {
            HandlerPipelineKey key = HandlerPipelineKey.ForMethod(method);

            _pipelines[key] = pipeline;
        }