Поділитися через


PollyHttpClientBuilderExtensions.AddPolicyHandlerFromRegistry Method

Definition

Overloads

AddPolicyHandlerFromRegistry(IHttpClientBuilder, Func<IReadOnlyPolicyRegistry<String>,HttpRequestMessage,IAsyncPolicy<HttpResponseMessage>>)

Adds a PolicyHttpMessageHandler which will surround request execution with a policy returned by the IReadOnlyPolicyRegistry<TKey>.

AddPolicyHandlerFromRegistry(IHttpClientBuilder, String)

Adds a PolicyHttpMessageHandler which will surround request execution with a policy returned by the IReadOnlyPolicyRegistry<TKey>.

AddPolicyHandlerFromRegistry(IHttpClientBuilder, Func<IReadOnlyPolicyRegistry<String>,HttpRequestMessage,IAsyncPolicy<HttpResponseMessage>>)

Adds a PolicyHttpMessageHandler which will surround request execution with a policy returned by the IReadOnlyPolicyRegistry<TKey>.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddPolicyHandlerFromRegistry(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<Polly::Registry::IReadOnlyPolicyRegistry<System::String ^> ^, System::Net::Http::HttpRequestMessage ^, Polly::IAsyncPolicy<System::Net::Http::HttpResponseMessage ^> ^> ^ policySelector);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandlerFromRegistry (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<Polly.Registry.IReadOnlyPolicyRegistry<string>,System.Net.Http.HttpRequestMessage,Polly.IAsyncPolicy<System.Net.Http.HttpResponseMessage>> policySelector);
static member AddPolicyHandlerFromRegistry : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<Polly.Registry.IReadOnlyPolicyRegistry<string>, System.Net.Http.HttpRequestMessage, Polly.IAsyncPolicy<System.Net.Http.HttpResponseMessage>> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddPolicyHandlerFromRegistry (builder As IHttpClientBuilder, policySelector As Func(Of IReadOnlyPolicyRegistry(Of String), HttpRequestMessage, IAsyncPolicy(Of HttpResponseMessage))) As IHttpClientBuilder

Parameters

policySelector
Func<IReadOnlyPolicyRegistry<String>,HttpRequestMessage,IAsyncPolicy<HttpResponseMessage>>

Selects an IAsyncPolicy`1 to apply to the current request.

Returns

An IHttpClientBuilder that can be used to configure the client.

Remarks

See the remarks on PolicyHttpMessageHandler for guidance on configuring policies.

Applies to

AddPolicyHandlerFromRegistry(IHttpClientBuilder, String)

Adds a PolicyHttpMessageHandler which will surround request execution with a policy returned by the IReadOnlyPolicyRegistry<TKey>.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddPolicyHandlerFromRegistry(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, System::String ^ policyKey);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandlerFromRegistry (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, string policyKey);
static member AddPolicyHandlerFromRegistry : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * string -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddPolicyHandlerFromRegistry (builder As IHttpClientBuilder, policyKey As String) As IHttpClientBuilder

Parameters

policyKey
String

The key used to resolve a policy from the IReadOnlyPolicyRegistry<TKey>.

Returns

An IHttpClientBuilder that can be used to configure the client.

Remarks

See the remarks on PolicyHttpMessageHandler for guidance on configuring policies.

Applies to