public WeatherServiceProvider(
            IMapper mapper,
            ApplicationDbContext context,
            IConfiguration config,
            IOpenWeatherMapApiService apiService,
            IOptions <ApiOptions> options
            )
        {
            _ = options ?? throw new NullReferenceException(nameof(options));
            _ = context ?? throw new ArgumentNullException(nameof(context));
            _ = apiService ?? throw new ArgumentNullException(nameof(apiService));
            _ = mapper ?? throw new ArgumentNullException(nameof(mapper));

            _options    = options.Value;
            _context    = context;
            _apiService = apiService;
            _mapper     = mapper;
        }
Exemple #2
0
 public GetForecastByCityNameHandler(IOpenWeatherMapApiService openWeatherMapApiService, IUserSearchRepository userSearchRepository, IMemoryCache cache)
 {
     _openWeatherMapApiService = openWeatherMapApiService;
     _userSearchRepository     = userSearchRepository;
     _cache = cache;
 }
Exemple #3
0
 public void Initialize()
 {
     _openWeatherMapService = new OpenWeatherMapApiService(
         _configuration["OpenWeatherMap.ApiKey"]);
 }