public async Task <IInstance> Load(Guid instanceId) { var prms = new ExpandoObject() { { "Id", instanceId } }; var eo = await _dbContext.ReadExpandoAsync(null, $"{Definitions.SqlSchema}.[Instance.Load]", prms); if (eo == null) { throw new SqlServerStorageException($"Instance '{instanceId}' not found"); } var identity = new Identity() { Id = eo.Get <String>("WorkflowId"), Version = eo.Get <Int32>("Version") }; return(new Instance() { Id = instanceId, Parent = eo.Get <Guid>("Parent"), Workflow = await _workflowStorage.LoadAsync(identity), State = _serializer.Deserialize(eo.Get <String>("State")), ExecutionStatus = Enum.Parse <WorkflowExecutionStatus>(eo.Get <String>("ExecutionStatus")), Lock = eo.Get <Guid>("Lock") }); }
public async ValueTask <IInstance> CreateAsync(IIdentity identity) { var wf = await _workflowStorage.LoadAsync(identity); return(await CreateAsync(wf.Root, wf.Identity)); }