Пример #1
0
            public IWorkflowBuilder <TOutput> AddSuccessor <TProcedure, TOutput>(TProcedure procedure)
                where TProcedure : Procedure, IProcedureOutput <TOutput>
            {
                procedure.Context = this.Context;
                var successorNode = new ProcedureTreeNode(procedure, null, typeof(TOutput));

                this.Node.AddSuccessor(successorNode);
                return(new Builder <TOutput>(successorNode, this.Context));
            }
Пример #2
0
            public IWorkflowBuilder AddSuccessor <TProcedure>(TProcedure procedure)
                where TProcedure : Procedure
            {
                procedure.Context = this.Context;
                var successorNode = new ProcedureTreeNode(procedure, null, null);

                this.Node.AddSuccessor(successorNode);
                return(new Builder(successorNode, this.Context));
            }
        public void AddProductConsumer(ProcedureTreeNode node)
        {
            if (this.OutputType == null)
            {
                throw new InvalidOperationException("this node does not have an output");
            }

            if (node.InputType == null)
            {
                throw new ArgumentException("specified node does not accept an input", nameof(node));
            }

            if (!node.InputType.IsAssignableFrom(this.OutputType))
            {
                throw new ArgumentException($"specified node does not accept an input of type {this.OutputType.Name}",
                                            nameof(node));
            }

            node.Procedure.Predecessor = this.Procedure;
            this.ProductConsumers.Add(node);
        }
Пример #4
0
 public Builder(ProcedureTreeNode node, object context)
 {
     this.Node    = node;
     this.Context = context;
 }
 public void AddSuccessor(ProcedureTreeNode node)
 {
     node.Procedure.Predecessor = this.Procedure;
     this.Successors.Add(node);
 }