Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class Microsoft.​Extensions.​DependencyInjection.​HttpClientFactoryServiceCollectionExtensions

Assembly: Microsoft.Extensions.Http

Inheritance: object → HttpClientFactoryServiceCollectionExtensions

Extension methods to configure an <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> for <see cref="T:System.Net.Http.IHttpClientFactory" /> .

Methods

public static IServiceCollection
AddHttpClient​(IServiceCollection services)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Action<​System.​IServiceProvider, System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Action<​System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> . The client name will be set to the type name of <typeparamref name="TClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, System.​Action<​System.​IServiceProvider, System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> . The client name will be set to the type name of <typeparamref name="TClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, System.​Action<​System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> . The client name will be set to the type name of <typeparamref name="TClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Action<​System.​IServiceProvider, System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Action<​System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> . The client name will be set to the type name of <typeparamref name="TClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, System.​Action<​System.​IServiceProvider, System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> . The client name will be set to the type name of <typeparamref name="TClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, System.​Action<​System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> . The client name will be set to the type name of <typeparamref name="TClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, System.​Func<​System.​Net.​Http.​HttpClient, System.​IServiceProvider, TImplementation> factory)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
factory A delegate that is used to create an instance of <typeparamref name="TClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, System.​Func<​System.​Net.​Http.​HttpClient, TImplementation> factory)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
factory A delegate that is used to create an instance of <typeparamref name="TClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Action<​System.​IServiceProvider, System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Action<​System.​Net.​Http.​HttpClient> configureClient)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
configureClient A delegate that is used to configure an <see cref="T:System.Net.Http.HttpClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <para> Use <see cref="F:Microsoft.Extensions.Options.Options.DefaultName" /> as the name to configure the default client. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Func<​System.​Net.​Http.​HttpClient, System.​IServiceProvider, TImplementation> factory)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
factory A delegate that is used to create an instance of <typeparamref name="TClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para>
public static IHttpClientBuilder
AddHttpClient​(IServiceCollection services, string name, System.​Func<​System.​Net.​Http.​HttpClient, TImplementation> factory)
Adds the <see cref="T:System.Net.Http.IHttpClientFactory" /> and related services to the <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> and configures a binding between the <typeparamref name="TClient" /> type and a named <see cref="T:System.Net.Http.HttpClient" /> .
Returns An <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> that can be used to configure the client.
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
name The logical name of the <see cref="T:System.Net.Http.HttpClient" /> to configure.
factory A delegate that is used to create an instance of <typeparamref name="TClient" /> .
Remarks <para> <see cref="T:System.Net.Http.HttpClient" /> instances that apply the provided configuration can be retrieved using <see cref="M:System.Net.Http.IHttpClientFactory.CreateClient(System.String)" /> and providing the matching name. </para> <para> <typeparamref name="TClient" /> instances constructed with the appropriate <see cref="T:System.Net.Http.HttpClient" /> can be retrieved from <see cref="M:System.IServiceProvider.GetService(System.Type)" /> (and related methods) by providing <typeparamref name="TClient" /> as the service type. </para> <typeparamref name="TImplementation"></typeparamref>
public static IServiceCollection
ConfigureHttpClientDefaults​(IServiceCollection services, System.​Action<​IHttpClientBuilder> configure)
Adds a delegate that will be used to configure all <see cref="T:System.Net.Http.HttpClient" /> instances.
Returns The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
services The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
configure A delegate that is used to configure an <see cref="T:Microsoft.Extensions.DependencyInjection.IHttpClientBuilder" /> .
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object