private async Task <WorkflowState> CreateGraphAndExecute(WorkflowContext context, IWorkflowLoader loader, IWorkflowContextPersistor instancePersistor, bool isResume = false) { IWorkflowInstance workflowInstance = loader.LoadWorkflow(context.WorkflowId, context.WorkflowVersion, context , new Controller(instancePersistor, context)); await workflowInstance.Initialize(); var state = isResume ? await workflowInstance.Resume() : await workflowInstance.Execute(); instancePersistor.Save(context); return(new WorkflowState() { Context = context.ToJson(), Id = workflowInstance.Id, State = state }); }
private WorkflowState CreateGraphAndExecute(WorkflowContext context, IWorkflowLoader loader, IWorkflowContextPersistor instancePersistor, bool isResume = false) { IWorkflowInstance workflowInstance = loader.LoadWorkflow(context.WorkflowId, context.WorkflowVersion, context , new Controller(instancePersistor, context)); workflowInstance.Initialize().Wait(); var state = isResume ? workflowInstance.Resume().Result :workflowInstance.Execute().Result; var persistentState = instancePersistor.Save(context); return(new WorkflowState() { Context = persistentState.Context, Id = persistentState.InstanceId, State = state, RequiredParameters = context.RequiredParameters.ToArray() }); }
public void Persist() { persistor.Save(context); }