Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }