/// <summary> /// Asynchronously gets a <see cref="IEnumerable{ISport}"/> representing all available sports in language specified by the <code>culture</code> /// </summary> /// <param name="culture">A <see cref="CultureInfo"/> specifying the language or a null reference to use the languages specified in the configuration</param> /// <returns>A <see cref="Task{T}"/> representing the async operation</returns> public async Task <IEnumerable <ISport> > GetSportsAsync(CultureInfo culture = null) { var cs = culture == null ? _defaultCultures : new[] { culture }; var s = cs.Aggregate(string.Empty, (current, cultureInfo) => current + (";" + cultureInfo.TwoLetterISOLanguageName)); s = s.Substring(1); Log.LogInformation($"Invoked GetSportsAsync: [Cultures={s}]."); var result = await _sportEntityFactory.BuildSportsAsync(cs, _exceptionStrategy).ConfigureAwait(false); return(result); }
/// <summary> /// Asynchronously gets a <see cref="IEnumerable{ISport}"/> representing all available sports in language specified by the <code>culture</code> /// </summary> /// <param name="culture">A <see cref="CultureInfo"/> specifying the language or a null reference to use the languages specified in the configuration</param> /// <returns>A <see cref="Task{T}"/> representing the async operation</returns> public async Task <IEnumerable <ISport> > GetSportsAsync(CultureInfo culture = null) { var cs = culture == null ? _defaultCultures : new[] { culture }; var s = cs.Aggregate(string.Empty, (current, cultureInfo) => current + (";" + cultureInfo.TwoLetterISOLanguageName)); s = s.Substring(1); try { LogInt.LogInformation($"Invoked GetSportsAsync: [Cultures={s}]"); var result = await _sportEntityFactory.BuildSportsAsync(cs, _exceptionStrategy).ConfigureAwait(false); return(result); } catch (Exception e) { LogInt.LogError(e, $"Error executing GetSportsAsync: [Cultures={s}]"); if (_exceptionStrategy == ExceptionHandlingStrategy.THROW) { throw; } return(null); } }