예제 #1
0
        public static Task <State> ExecuteAsync(this IWorkflowRegistry registry, string name, State state, CancellationToken cancellationToken)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            var workflow = registry.GetWorkflow(name);

            if (workflow == null)
            {
                throw new WorkflowExecutionException($"No workflow named '{name}' was specified in the registry");
            }

            return(workflow.ExecuteAsync(state, cancellationToken));
        }