public virtual WorkDefine.Workflow GetWorkflow(IWorkflowBuilder <TModel> workflowBuilder) { Builder <TModel> builder = (Builder <TModel>)workflowBuilder.GetBuilder(); foreach (var action in builder.actions) { this.ActionFactory.AddAction(action.Key, action.Value); } foreach (var eval in builder.evaluators) { this.EvaluatorFactory.AddEvaluator(eval.Key, eval.Value); } if (builder.chained != null && builder.chained.Count > 0) { this.BuilderFactory.Builders = builder.chained; } WorkDefine.Workflow toReturn = ((IBuilderWorkflow <TModel>)builder).Workflow; if (this.Configuration.Ordinal > 0) { WorkflowManager mgr = new WorkflowManager(toReturn, this.Configuration); mgr.RenameWorkflow(string.Format("{0}{1}{2}", toReturn.Id, Configuration.Convention.Delimeter, this.Configuration.Ordinal)); } return(toReturn); }
IFluentActivityBuilder <T> IFluentActivityBuilder <T> .Chain(IWorkflowBuilder <T> builder) { WorkDefine.Activity parent = default(WorkDefine.Activity); //get the parent, add this as a reaction parent = this.activityStack.Peek(); string workflowId = builder.GetBuilder().Workflow.Id; string origWorkflowId = workflowId; if (this.chained.ContainsKey(workflowId)) { workflowId = workflowId + (this.chained.Count() + 1).ToString(); } this.chained.Add(workflowId, builder); string actionId = $"chain{workflowId}"; this.Do(a => a.Do(new ChainFlowAction <T>(actionId, builder)), () => new ActionDefinition() { Id = actionId, Description = $"Chain.{origWorkflowId}" }); parent.Reactions.Add(new WorkDefine.Reaction() { Work = this.created.ToString() }); return(this); }
internal ChainFlowAction(string actionId, IWorkflowBuilder <TModel> builder) { this.actionId = actionId; this.builder = builder; this.workflowId = builder.GetBuilder().Workflow.Id; }
public WorkDefine.Workflow GetWorkflow(IWorkflowBuilder <TModel> builder) { return(builder.GetBuilder().Workflow); }