Ejemplo n.º 1
0
        private void AddActivityResultToData(IWorkflowActivityBase activity, WorkflowActivityOutput result)
        {
            var data = Data.SingleOrDefault(d => d.ActivityId == activity.Id);

            if (data != null)
            {
                Data.Remove(data);
            }

            Data.Add(new ActivityData {
                ActivityId = activity.Id, Output = result
            });
        }
Ejemplo n.º 2
0
        /// <exception cref="WorkflowException">A workflow exception occurred. </exception>
        private async Task <WorkflowActivityOutput> HandleCompletionSuccess(IWorkflowActivityBase activity, WorkflowActivityOutput result)
        {
            AddActivityResultToData(activity, result);

            var nextActivities = result.GetNextActivities(activity, WorkflowDefinition);

            if (nextActivities == null)
            {
                nextActivities = GetDefaultNextActivities(activity);
            }

            if (!(activity is ForkActivity) && nextActivities.Length > 1)
            {
                throw new WorkflowException(string.Format("Activity ({0}) has multiple next activities ({1}) " +
                                                          "but only ForkActivity activities can return multiple activities. ",
                                                          activity.Id, string.Join(", ", nextActivities.Select(a => a.Id))));
            }

            CurrentActivityIds.Remove(activity.Id);

            await AddNextActivitiesAsync(activity, nextActivities);

            return(result);
        }
Ejemplo n.º 3
0
 private static WorkflowActivityOutput HandleCompletionFailed(WorkflowActivityOutput result)
 {
     return(result);
 }