Exemple #1
0
        /// <summary>
        /// Schedule the child workflow.
        /// </summary>
        /// <param name="name">Child workflow name.</param>
        /// <param name="version">Child workflow version.</param>
        /// <param name="positionalName">Positional parameter, if any, useful in scheduling same workflow multiple times.</param>
        /// <returns></returns>
        protected IFluentChildWorkflowItem ScheduleChildWorkflow(string name, string version,
                                                                 string positionalName = "")
        {
            Ensure.NotNullAndEmpty(name, nameof(name));
            Ensure.NotNullAndEmpty(version, nameof(version));
            var childWorkflowItem = new ChildWorkflowItem(Identity.New(name, version, positionalName), this);

            _allWorkflowItems.Add(childWorkflowItem);
            return(childWorkflowItem);
        }
        public IEnumerable <WorkflowItemEvent> AllChildWorkflowEvents(ChildWorkflowItem childWorkflowItem)
        {
            var allEvents = new List <WorkflowItemEvent>();

            foreach (var historyEvent in AllEventsInDescOrderOfEventId)
            {
                var childWorkflowEvent = historyEvent.ChildWorkflowEvent(_workflowTask.AllEvents);
                if (childWorkflowEvent == null)
                {
                    continue;
                }
                if (childWorkflowEvent.IsFor(childWorkflowItem) && !childWorkflowEvent.InChainOf(allEvents))
                {
                    allEvents.Add(childWorkflowEvent);
                    yield return(childWorkflowEvent);
                }
            }
        }
 public WorkflowItemEvent LastChildWorkflowEvent(ChildWorkflowItem childWorkflowItem)
 {
     return(AllChildWorkflowEvents(childWorkflowItem).FirstOrDefault(e => !LastEventFilters.ChildWorkflow.Contains(e)));
 }