Open
Description
Type of issue
Code doesn't work
Description
The following code example makes it unclear where the private read-only field _remoteServiceBaseUrl
is set from. It is not injected via the constructor nor has a constant value set or a way to be set from another class.
public class CatalogService : ICatalogService
{
private readonly HttpClient _httpClient;
private readonly string _remoteServiceBaseUrl;
public CatalogService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<Catalog> GetCatalogItems(int page, int take,
int? brand, int? type)
{
var uri = API.Catalog.GetAllCatalogItems(_remoteServiceBaseUrl,
page, take, brand, type);
var responseString = await _httpClient.GetStringAsync(uri);
var catalog = JsonConvert.DeserializeObject<Catalog>(responseString);
return catalog;
}
}
Page URL
Content source URL
Document Version Independent Id
Article author
Metadata
- ID: 7b506236-b211-eb9d-b571-5efecdde76c8
- Service: dotnet-architecture
- Sub-service: microservices