コード例 #1
0
        public static Pipeline BuildPipelineWithAtributeBlocks(string action, int processor, RequestHandler request)
        {
            _lstPipelineBlocks.TryGetValue(action, out List <PipelineBuilderBlock> lst);
            if (lst == null)
            {
                return(null);
            }

            Pipeline pipeline = new Pipeline();

            foreach (PipelineBuilderBlock blck in lst)
            {
                PipelineBlock b = blck.CreatePipelineblock();
                foreach (PipelineBuilderBlockActions blckAction in blck._lstActions)
                {
                    //skip if there is no match on processor
                    if ((blckAction._processor > 0) && (processor != blckAction._processor))
                    {
                        continue;
                    }
                    PipelineElement.PipelineExecutionFunc func = blckAction.CreatePipelineFunc(b);
                    pipeline.AddStep(new PipelineElement(b._sName, blckAction._order, func));
                }
            }
            return(pipeline);
        }
コード例 #2
0
        internal PipelineElement.PipelineExecutionFunc CreatePipelineFunc(PipelineBlock b)
        {
            //instead of doing Reflection we will do magic with delegates
            //return (PipelineElement.PipelineExecutionFunc)_mInfo.CreateDelegate(typeof(PipelineElement.PipelineExecutionFunc), b);

            return(delegate(PipelineContext ctx) {
                return (PipelineElement.EXECUTIONSTATUS)_func(b, ctx);
            });
        }