Exemple #1
0
 public WeatherService(ILogger <WeatherService> logger,
                       WeatherServiceSettings settings,
                       IWeatherProvider weatherProvider)
 {
     _logger          = logger;
     _settings        = settings;
     _weatherProvider = weatherProvider;
 }
Exemple #2
0
        private void RegisterServices(IServiceCollection services)
        {
            // settings
            WeatherServiceSettings weatherServiceSettings = new WeatherServiceSettings();

            Configuration.GetSection("WeatherServiceSettings").Bind(weatherServiceSettings);
            services.AddSingleton <WeatherServiceSettings>(weatherServiceSettings);

            AppSettings appSettings = new AppSettings();

            Configuration.GetSection("AppSettings").Bind(appSettings);
            services.AddSingleton <AppSettings>(appSettings);

            // services
            services.AddScoped <IUserService, UserService>();
            services.AddScoped <IRunService, RunService>();
            services.AddScoped <ITokenService, TokenService>();
            services.AddScoped <IWeatherService, WeatherService>();
            services.AddScoped <IRoleService, RoleService>();

            // weather provider
            services.AddScoped <IWeatherProvider, DarkSkyWeatherProvider>();
        }
Exemple #3
0
 public FaultService(IHttpClientFactory httpClientFactory, IOptions <WeatherServiceSettings> configuration, IGetForecast getForecast)
 {
     _httpClientFactory = httpClientFactory;
     _configuration     = configuration.Value;
     _getForecast       = getForecast;
 }
Exemple #4
0
 public YandexStorage(IHttpClientFactory httpClientFactory, IOptions <WeatherServiceSettings> configuration)
 {
     _httpClientFactory = httpClientFactory;
     _configuration     = configuration.Value;
 }
Exemple #5
0
 public DarkSkyWeatherProvider(WeatherServiceSettings settings)
 {
     _darkSkyService = new DarkSkyService(settings.ApiKey);
 }