public async Task InsertOrReplaceCountry(CountryModel country) { await using var context = new DatabaseContext(_dbContextOptionsBuilder.Options); await context.UpsertAsync(new[] { country }); await _cache.InsertOrReplaceAsync(KycCountryNoSqlEntity.Create(country)); }
public async Task RefreshCache() { await using var context = new DatabaseContext(_dbContextOptionsBuilder.Options); var countries = context.Countries.ToList(); foreach (var country in countries) { await _cache.InsertOrReplaceAsync(KycCountryNoSqlEntity.Create(country)); } }