private void CreateTransientWorkSteps(WorkItem item, WorkStep expandStep) { Debug.Assert(expandStep.Type == WorkStepType.Expand); var transientRootPath = ExpandedWorkStep.GetTransientPath(expandStep, item); CreateTransientWorkStepsRecursively(transientRootPath, expandStep, item.Id); var workItemClass = WorkItemClass.Combine(expandStep.WorkItemClass, item.Id); var transientWorkStep = WorkStep.New(transientRootPath).UpdateFrom(expandStep).UpdateType(WorkStepType.Transient).UpdateWorkItemClass(workItemClass); WorkflowRepository.CreateWorkStep(transientWorkStep); }
private void CreateTransientWorkStepsRecursively(string transientRootPath, WorkStep rootStep, string workItemId) { var subSteps = WorkflowRepository.GetChildWorkSteps(rootStep.Path).Where(ws => ws.Type != WorkStepType.Transient); foreach (var childStep in subSteps) { var offset = childStep.Path.Remove(0, rootStep.Path.Length); var childTransientPath = transientRootPath + offset; var workItemClass = WorkItemClass.Combine(childStep.WorkItemClass, workItemId); WorkflowRepository.CreateWorkStep(WorkStep.New(childTransientPath).UpdateFrom(childStep).UpdateWorkItemClass(workItemClass)); CreateTransientWorkStepsRecursively(childTransientPath, childStep, workItemId); } }