Named and typed HttpClient improvements (#26999)
parent
73d473e04b
commit
33db9a39dd
|
@ -213,6 +213,9 @@ In the following component code, the `<button>` element calls the `DeleteItem` m
|
|||
|
||||
<xref:System.Net.Http.IHttpClientFactory> services and the configuration of a named <xref:System.Net.Http.HttpClient> are supported.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory> is to use a typed <xref:System.Net.Http.HttpClient>. For more information, see the [Typed `HttpClient`](#typed-httpclient) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
@ -277,6 +280,13 @@ else
|
|||
|
||||
Typed <xref:System.Net.Http.HttpClient> uses one or more of the app's <xref:System.Net.Http.HttpClient> instances, default or named, to return data from one or more web API endpoints.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a typed <xref:System.Net.Http.HttpClient> is to use a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory>. For more information, see the [Named `HttpClient` with `IHttpClientFactory`](#named-httpclient-with-ihttpclientfactory) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
||||
`WeatherForecastClient.cs`:
|
||||
|
||||
```csharp
|
||||
|
@ -830,6 +840,9 @@ In the following component code, the `<button>` element calls the `DeleteItem` m
|
|||
|
||||
<xref:System.Net.Http.IHttpClientFactory> services and the configuration of a named <xref:System.Net.Http.HttpClient> are supported.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory> is to use a typed <xref:System.Net.Http.HttpClient>. For more information, see the [Typed `HttpClient`](#typed-httpclient) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
@ -894,6 +907,13 @@ else
|
|||
|
||||
Typed <xref:System.Net.Http.HttpClient> uses one or more of the app's <xref:System.Net.Http.HttpClient> instances, default or named, to return data from one or more web API endpoints.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a typed <xref:System.Net.Http.HttpClient> is to use a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory>. For more information, see the [Named `HttpClient` with `IHttpClientFactory`](#named-httpclient-with-ihttpclientfactory) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
||||
`WeatherForecastClient.cs`:
|
||||
|
||||
```csharp
|
||||
|
@ -1449,6 +1469,9 @@ In the following component code, the `<button>` element calls the `DeleteItem` m
|
|||
|
||||
<xref:System.Net.Http.IHttpClientFactory> services and the configuration of a named <xref:System.Net.Http.HttpClient> are supported.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory> is to use a typed <xref:System.Net.Http.HttpClient>. For more information, see the [Typed `HttpClient`](#typed-httpclient) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
@ -1513,6 +1536,13 @@ else
|
|||
|
||||
Typed <xref:System.Net.Http.HttpClient> uses one or more of the app's <xref:System.Net.Http.HttpClient> instances, default or named, to return data from one or more web API endpoints.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a typed <xref:System.Net.Http.HttpClient> is to use a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory>. For more information, see the [Named `HttpClient` with `IHttpClientFactory`](#named-httpclient-with-ihttpclientfactory) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
||||
`WeatherForecastClient.cs`:
|
||||
|
||||
```csharp
|
||||
|
@ -2068,6 +2098,9 @@ In the following component code, the `<button>` element calls the `DeleteItem` m
|
|||
|
||||
<xref:System.Net.Http.IHttpClientFactory> services and the configuration of a named <xref:System.Net.Http.HttpClient> are supported.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory> is to use a typed <xref:System.Net.Http.HttpClient>. For more information, see the [Typed `HttpClient`](#typed-httpclient) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
@ -2132,6 +2165,13 @@ else
|
|||
|
||||
Typed <xref:System.Net.Http.HttpClient> uses one or more of the app's <xref:System.Net.Http.HttpClient> instances, default or named, to return data from one or more web API endpoints.
|
||||
|
||||
> [!NOTE]
|
||||
> An alternative to using a typed <xref:System.Net.Http.HttpClient> is to use a named <xref:System.Net.Http.HttpClient> from an <xref:System.Net.Http.IHttpClientFactory>. For more information, see the [Named `HttpClient` with `IHttpClientFactory`](#named-httpclient-with-ihttpclientfactory) section.
|
||||
|
||||
Add the [`Microsoft.Extensions.Http`](https://www.nuget.org/packages/Microsoft.Extensions.Http) NuGet package to the app.
|
||||
|
||||
[!INCLUDE[](~/includes/package-reference.md)]
|
||||
|
||||
`WeatherForecastClient.cs`:
|
||||
|
||||
```csharp
|
||||
|
|
Loading…
Reference in New Issue