SplitForParallelism() public method

public SplitForParallelism ( WorkItem workItem, WorkStep parallelRootStep ) : IEnumerable
workItem WorkItem
parallelRootStep WorkStep
return IEnumerable
Ejemplo n.º 1
0
        private WorkItem CreateParallelledChildrenAndReturnWorkItemToMove(WorkItemTransition transition, WorkStep parallelStep)
        {
            var helper = new ParallelStepHelper(WorkflowRepository);

            var splitWorkItems = helper.SplitForParallelism(transition.WorkItem, parallelStep);

            foreach (var splitWorkItem in splitWorkItems)
            {
                WorkflowRepository.CreateWorkItem(splitWorkItem);

                WorkStep expandStep;
                var      isInExpandStep = WorkflowRepository.IsInExpandStep(transition.WorkItem, out expandStep);
                if (isInExpandStep)
                {
                    CreateTransientWorkSteps(splitWorkItem, expandStep);
                }
            }

            var idToMove       = ParallelStepHelper.GetParallelId(transition.WorkItem.Id, parallelStep, transition.WorkStep);
            var workItemToMove = splitWorkItems.First(wi => wi.Id == idToMove);

            return(workItemToMove);
        }
Ejemplo n.º 2
0
        private WorkItem CreateParallelledChildrenAndReturnWorkItemToMove(WorkItemTransition transition, WorkStep parallelStep)
        {
            var helper = new ParallelStepHelper(WorkflowRepository);

            var splitWorkItems = helper.SplitForParallelism(transition.WorkItem, parallelStep);

            foreach (var splitWorkItem in splitWorkItems)
            {
                WorkflowRepository.CreateWorkItem(splitWorkItem);

                WorkStep expandStep;
                var isInExpandStep = WorkflowRepository.IsInExpandStep(transition.WorkItem, out expandStep);
                if (isInExpandStep)
                {
                    CreateTransientWorkSteps(splitWorkItem, expandStep);
                }
            }

            var idToMove = ParallelStepHelper.GetParallelId(transition.WorkItem.Id, parallelStep, transition.WorkStep);
            var workItemToMove = splitWorkItems.First(wi => wi.Id == idToMove);

            return workItemToMove;
        }