HttpClientBuilderExtensions.AddTypedClient メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
| 名前 | 説明 |
|---|---|
| AddTypedClient<TClient,TImplementation>(IHttpClientBuilder) |
|
| AddTypedClient<TClient>(IHttpClientBuilder) |
|
| AddTypedClient<TClient>(IHttpClientBuilder, Func<HttpClient,IServiceProvider,TClient>) |
|
| AddTypedClient<TClient>(IHttpClientBuilder, Func<HttpClient,TClient>) |
|
AddTypedClient<TClient,TImplementation>(IHttpClientBuilder)
TClient型と、HttpClientに関連付けられている名前付きIHttpClientBuilderとの間のバインディングを構成します。 作成されたインスタンスは、 TImplementation型になります。
public:
generic <typename TClient, typename TImplementation>
where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddTypedClient(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddTypedClient<TClient,TImplementation>(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder) where TClient : class where TImplementation : class, TClient;
static member AddTypedClient : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddTypedClient(Of TClient As Class, TImplementation As Class) (builder As IHttpClientBuilder) As IHttpClientBuilder
型パラメーター
- TClient
型指定されたクライアントの宣言された型。 指定された型は、一時的なサービスとしてサービス コレクションに登録されます。 型指定されたクライアントの作成の詳細については、 ITypedHttpClientFactory<TClient> を参照してください。
- TImplementation
型指定されたクライアントの実装型。 指定された型は、 ITypedHttpClientFactory<TClient>によってインスタンス化されます。
パラメーター
- builder
- IHttpClientBuilder
返品
注釈
TClient適切なHttpClientで構築されたインスタンスは、サービスの種類としてGetService(Type)を指定することで、TClient (および関連するメソッド) から取得できます。
AddTypedClient<TClient,TImplementation>(IHttpClientBuilder)を呼び出すと、ITypedHttpClientFactory<TClient>を使用してTImplementationを作成する型指定されたクライアント バインドが登録されます。
型指定されたクライアントのサービス依存関係は、型指定されたクライアントの解決に使用されるのと同じサービス プロバイダーから解決されます。 個別に管理されるメッセージ ハンドラーにバインドされたスコープからサービスにアクセスすることはできません。
適用対象
AddTypedClient<TClient>(IHttpClientBuilder)
TClient型と、HttpClientに関連付けられている名前付きIHttpClientBuilderとの間のバインディングを構成します。
public:
generic <typename TClient>
where TClient : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddTypedClient(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddTypedClient<TClient>(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder) where TClient : class;
static member AddTypedClient : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddTypedClient(Of TClient As Class) (builder As IHttpClientBuilder) As IHttpClientBuilder
型パラメーター
- TClient
型指定されたクライアントの型。 指定された型は、一時的なサービスとしてサービス コレクションに登録されます。 型指定されたクライアントの作成の詳細については、 ITypedHttpClientFactory<TClient> を参照してください。
パラメーター
- builder
- IHttpClientBuilder
返品
注釈
TClient適切なHttpClientで構築されたインスタンスは、サービスの種類としてGetService(Type)を指定することで、TClient (および関連するメソッド) から取得できます。
AddTypedClient<TClient>(IHttpClientBuilder)を呼び出すと、ITypedHttpClientFactory<TClient>を使用してTClientを作成する型指定されたクライアント バインドが登録されます。
型指定されたクライアントのサービス依存関係は、型指定されたクライアントの解決に使用されるのと同じサービス プロバイダーから解決されます。 個別に管理されるメッセージ ハンドラーにバインドされたスコープからサービスにアクセスすることはできません。
適用対象
AddTypedClient<TClient>(IHttpClientBuilder, Func<HttpClient,IServiceProvider,TClient>)
TClient型と、HttpClientに関連付けられている名前付きIHttpClientBuilderとの間のバインディングを構成します。
public:
generic <typename TClient>
where TClient : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddTypedClient(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<System::Net::Http::HttpClient ^, IServiceProvider ^, TClient> ^ factory);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddTypedClient<TClient>(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<System.Net.Http.HttpClient,IServiceProvider,TClient> factory) where TClient : class;
static member AddTypedClient : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<System.Net.Http.HttpClient, IServiceProvider, 'Client (requires 'Client : null)> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddTypedClient(Of TClient As Class) (builder As IHttpClientBuilder, factory As Func(Of HttpClient, IServiceProvider, TClient)) As IHttpClientBuilder
型パラメーター
- TClient
型指定されたクライアントの型。 指定された型は、一時的なサービスとしてサービス コレクションに登録されます。
パラメーター
- builder
- IHttpClientBuilder
- factory
- Func<HttpClient,IServiceProvider,TClient>
型指定されたクライアントの構築に使用されるファクトリ関数。
返品
注釈
TClient適切なHttpClientで構築されたインスタンスは、サービスの種類としてGetService(Type)を指定することで、TClient (および関連するメソッド) から取得できます。
AddTypedClient<TClient>(IHttpClientBuilder, Func<HttpClient,IServiceProvider,TClient>)を呼び出すと、指定されたファクトリ関数を使用してTClientを作成する型指定されたクライアント バインドが登録されます。
適用対象
AddTypedClient<TClient>(IHttpClientBuilder, Func<HttpClient,TClient>)
TClient型と、HttpClientに関連付けられている名前付きIHttpClientBuilderとの間のバインディングを構成します。
public:
generic <typename TClient>
where TClient : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddTypedClient(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<System::Net::Http::HttpClient ^, TClient> ^ factory);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddTypedClient<TClient>(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<System.Net.Http.HttpClient,TClient> factory) where TClient : class;
static member AddTypedClient : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<System.Net.Http.HttpClient, 'Client (requires 'Client : null)> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddTypedClient(Of TClient As Class) (builder As IHttpClientBuilder, factory As Func(Of HttpClient, TClient)) As IHttpClientBuilder
型パラメーター
- TClient
型指定されたクライアントの型。 指定された型は、一時的なサービスとしてサービス コレクションに登録されます。
パラメーター
- builder
- IHttpClientBuilder
- factory
- Func<HttpClient,TClient>
型指定されたクライアントの構築に使用されるファクトリ関数。
返品
注釈
TClient適切なHttpClientで構築されたインスタンスは、サービスの種類としてGetService(Type)を指定することで、TClient (および関連するメソッド) から取得できます。
AddTypedClient<TClient>(IHttpClientBuilder, Func<HttpClient,TClient>)を呼び出すと、指定されたファクトリ関数を使用してTClientを作成する型指定されたクライアント バインドが登録されます。