public async Task <TekReleaseWorkflowStateEntity> Execute() { var entity = new TekReleaseWorkflowStateEntity { Created = _DateTimeProvider.Snapshot.Date, ValidUntil = _WorkflowTime.Expiry(_DateTimeProvider.Snapshot) }; await _WorkflowDbContext.KeyReleaseWorkflowStates.AddAsync(entity); _Logger.WriteWritingStart(); var success = WriteAttempt(entity); while (!success) { entity = new TekReleaseWorkflowStateEntity { Created = _DateTimeProvider.Snapshot.Date, ValidUntil = _WorkflowTime.Expiry(_DateTimeProvider.Snapshot) }; await _WorkflowDbContext.KeyReleaseWorkflowStates.AddAsync(entity); success = WriteAttempt(entity); } return(entity); }
private async Task <TekReleaseWorkflowStateEntity> BuildEntityAndAddToContextAsync() { var entity = new TekReleaseWorkflowStateEntity { Created = _dateTimeProvider.Snapshot.Date, ValidUntil = _workflowTime.Expiry(_dateTimeProvider.Snapshot) }; await _workflowDbContext.KeyReleaseWorkflowStates.AddAsync(entity); return(entity); }