/// <inheritdoc /> public async Task <IReadOnlyList <CultureResourceEntity> > GetAllAsync(string culture, CancellationToken cancellationToken) { _logger.LogDebug($"Retrieving all culture resources for culture={culture}."); try { var spec = new GetManySpecification <CultureResourceEntity>(); spec.AddConfiguration(q => q.Include(a => a.Culture)); spec.AddFilter(r => r.Culture.Name == null || r.Culture.Name == culture); var resource = await _resourceStore.GetManyAsync(spec, cancellationToken : cancellationToken).ConfigureAwait(false); if (resource?.Any(a => a.Culture.Name != null) == true) { return(resource); } _logger.LogWarning($"No resources found for culture={culture}."); return(Array.Empty <CultureResourceEntity>()); } catch (Exception e) { _logger.LogError(e, message: "Exception occured while reading database."); throw; } }
/// <inheritdoc /> public async Task <IReadOnlyList <CultureEntity> > GetCulturesAsync(CancellationToken cancellationToken) { var spec = new GetManySpecification <CultureEntity>(); spec.AddConfiguration(q => q.Include(a => a.Resources)); spec.AddFilter(a => a.ActiveFlag); var cultures = await _store.GetManyAsync(spec, cancellationToken : cancellationToken).ConfigureAwait(false); return(cultures); }