public WeatherService(ILogger <WeatherService> logger, WeatherServiceSettings settings, IWeatherProvider weatherProvider) { _logger = logger; _settings = settings; _weatherProvider = weatherProvider; }
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>(); }
public FaultService(IHttpClientFactory httpClientFactory, IOptions <WeatherServiceSettings> configuration, IGetForecast getForecast) { _httpClientFactory = httpClientFactory; _configuration = configuration.Value; _getForecast = getForecast; }
public YandexStorage(IHttpClientFactory httpClientFactory, IOptions <WeatherServiceSettings> configuration) { _httpClientFactory = httpClientFactory; _configuration = configuration.Value; }
public DarkSkyWeatherProvider(WeatherServiceSettings settings) { _darkSkyService = new DarkSkyService(settings.ApiKey); }