Пример #1
0
        async Task <WorkflowContainerExecutionResult> IWorkflowContainer <TWorkflow, TOutput> .Execute(PluginInputs workflowInputs)
        {
            EnsureContainerIsInitialized();
            if (_containerContext.Executed)
            {
                throw new WorkflowEngineException("Cannot execute workflow container more than once.");
            }

            var rootWorkflow = _pluginServices.LoadPlugin <TWorkflow>(_containerContext.RootPluginContext);

            _containerContext.Executed          = true;
            _containerContext.ContainerInputs   = workflowInputs ?? throw new WorkflowEngineException("Cannot execute container with null inputs");
            _containerContext.RootPluginContext = rootWorkflow.GetContext();
            _containerContext.ExecutionContext  = _pluginServices.GetExecutionContext();

            _rootWorkflowOutput = await rootWorkflow.Execute <TOutput>(workflowInputs).ConfigureAwait(false);

            return(_rootWorkflowOutput == null ? WorkflowContainerExecutionResult.PartiallyCompleted : WorkflowContainerExecutionResult.Completed);
        }