예제 #1
0
파일: Pipeline.cs 프로젝트: Adebeer/pypn
        public void RunCommand <TPayload>(string commandName, TPayload payload)
        {
            var commandParams = new CommandParams <TPayload>(commandName)
            {
                Payload = payload
            };

            var callContext = new StageCallContext <TPayload>(commandName, commandParams, Stages.Count);

            if (callContext.MaxStageIndex > 0)
            {
                RunNextStageCommand(callContext, 0);
            }
        }
예제 #2
0
파일: Pipeline.cs 프로젝트: Adebeer/pypn
        public void RunAdHocCommand <TStage, TPayload>(string defaultCommandName, TPayload payload, ICommandDefinition <TStage, TPayload> command)
            where TStage : class
        {
            var commandParams = new CommandParams <TPayload>(defaultCommandName)
            {
                Payload = payload
            };

            var customCommands = Stages.OfType <PipelineStage <TStage> >()
                                 .ToDictionary(
                x => x.Config.Name,
                x => (IStageCommand <TPayload>) new StageCommand <TStage, TPayload>(x.Stage, command));

            var callContext = new StageCallContext <TPayload>(defaultCommandName, commandParams, Stages.Count, customCommands);

            if (callContext.MaxStageIndex > 0)
            {
                RunNextStageCommand(callContext, 0);
            }
        }