private async Task DoWork(CancellationToken stoppingToken) { using (var scope = _serviceProvider.CreateScope()) { _numberOfResults = (scope.ServiceProvider.GetRequiredService <IOptions <AppSettings> >()).Value.NumberOfResults; _adapterConsumerServices = scope.ServiceProvider.GetRequiredService <IAdapterConsumerServices>(); _bestStoriesDetailsRepository = scope.ServiceProvider.GetRequiredService <IBestStoriesDetailsRepository>(); var storiesIds = (await _adapterConsumerServices.GetBestStories()).ToArray(); var bestStoriesDetails = new List <BestStorieDetailInputDTO>(); var task = storiesIds[.._numberOfResults].ToList().Select(async(storieId) =>
public GetStoriesDetailsSerices(IBestStoriesDetailsRepository bestStoriesDetailsRepository) { _bestStoriesDetailsRepository = bestStoriesDetailsRepository; }