// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc() .AddXmlSerializerFormatters(); services.AddResponseCaching(); services.AddScoped <IExchangeRateRepository, ExchangeRateRepository>(); services.AddScoped <IHttpClientWrapper, HttpClientWrapper>(); services.AddSingleton(new HttpClient()); var endpointConfig = new DailyCurrencyRatesEndpointConfiguration(Configuration.GetSection("DailyCurrencyRateEndpoint") .Value); services.AddSingleton(endpointConfig); services.AddScoped <IExchangeRateSl, ExchangeRateSl>(); }
public HttpClientWrapper(HttpClient httpClient, DailyCurrencyRatesEndpointConfiguration configuration) { this.httpClient = httpClient; this.configuration = configuration; }