Пример #1
0
        public CommandPipeline(ExclusiveHandlerCommandBus commandBus)
        {
            Guard.EnsureNotNull(commandBus, nameof(commandBus));

            IssueCommand = new IssueCommand(commandBus);
            rootStage    = IssueCommand;
        }
Пример #2
0
        public void SetRoot(CommandPipelineStage root)
        {
            Guard.EnsureNotNull(root, nameof(root));
            EnsureIssueCommandInPipeline(root);

            rootStage = root;
        }
Пример #3
0
        private static void EnsureIssueCommandInPipeline(CommandPipelineStage root)
        {
            var issueCommandStage = FindStage <IssueCommand>(root);

            if (issueCommandStage == null)
            {
                throw new MissingIssueCommandStageException();
            }
        }
Пример #4
0
        private static TStage FindStage <TStage>(CommandPipelineStage stage) where TStage : CommandPipelineStage
        {
            var s = stage as TStage;

            if (s != null)
            {
                return(s);
            }

            if (stage.Next != null)
            {
                return(FindStage <TStage>(stage.Next));
            }

            return(null);
        }