Esempio n. 1
0
 /// <summary>
 /// Constructs a <see cref="CategoryService" /> using a typed <see cref="HttpClient" />.
 /// </summary>
 /// <param name="httpClient"></param>
 public CategoryService(HttpClient httpClient, IOptionsMonitor <RecipeApiOptions> optionsAccessor,
                        ILogger <RecipeService> logger)
 {
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
     _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _options    = optionsAccessor.CurrentValue ?? throw new ArgumentNullException(nameof(optionsAccessor));
 }
Esempio n. 2
0
 /// <summary>
 /// Constructs a <see cref="RecipeService" /> using a typed <see cref="HttpClient" />.
 /// </summary>
 /// <param name="httpClient"></param>
 public RecipeService(HttpClient httpClient, IOptionsMonitor <RecipeApiOptions> optionsAccessor,
                      ILogger <RecipeService> logger)
 {
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
     _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _options    = optionsAccessor.CurrentValue ?? throw new ArgumentNullException(nameof(optionsAccessor));
     _recipeUri  = Path.Combine(_options.RecipeApiBaseUrl, "recipes");
     _logger.LogDebug("RecipeApi url is {0}", _recipeUri);
 }