private async Task StartAsync() { _logger.LogInformation("Getting DB State"); try { var state = await _getState.GetAsync(); if (state == null) { await _setState.SaveStateAsync(new AppState { Id = Constants.DefaultAppInstance, DbVersion = 0, CurrentLedgerPeriod = string.Empty }); } _logger.LogInformation("done"); Context.Parent.Tell(new DbMainetanceDoneMessage()); } catch (Exception ex) { _logger.LogError(ex, "Error getting state for maintenance"); throw; } }
public async Task SetPeriodAsync(string newPeriod) { var state = await _getState.GetAsync(); if (state.CurrentLedgerPeriod != newPeriod) { state.CurrentLedgerPeriod = newPeriod; await _setState.SaveStateAsync(state); } }
public async Task <string> GetPeriodAsync() { var @as = await _getAppStateQuery.GetAsync(); return(@as?.CurrentLedgerPeriod); }