<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.17" />

Microsoft.Rest.ServiceClient<T>

public abstract class ServiceClient<T> : IDisposable where T : ServiceClient<T>
ServiceClient is the abstraction for accessing REST operations and their payload data types..
protected HttpMessageHandler FirstMessageHandler { get; protected set; }

Reference to the first HTTP handler (which is the start of send HTTP pipeline).

public HttpClient HttpClient { get; protected set; }

Gets the HttpClient used for making HTTP requests.

protected HttpClientHandler HttpClientHandler { get; protected set; }

Reference to the innermost HTTP handler (which is the end of send HTTP pipeline).

Get the HTTP pipelines for the given service client.

Gets the UserAgent collection which can be augmented with custom user agent strings.

protected ServiceClient()

Initializes a new instance of the ServiceClient class.

protected ServiceClient(HttpClient httpClient, bool disposeHttpClient = true)

Initializes a new instance of the ServiceClient class.

protected ServiceClient(DelegatingHandler[] handlers)

Initializes a new instance of the ServiceClient class.

protected ServiceClient(HttpClientHandler rootHandler, DelegatingHandler[] handlers)

Initializes ServiceClient using base HttpClientHandler and list of handlers.

Create a new instance of the root handler.

protected virtual DelegatingHandler CreateHttpHandlerPipeline(HttpClientHandler httpClientHandler, DelegatingHandler[] handlers)

Creates DelegatingHandler pipeline chain that will be used for further communication. The handlers are invoked in a top-down fashion. That is, the first entry is invoked first for an outbound request message but last for an inbound response message.

public void Dispose()

Dispose the ServiceClient.

protected virtual void Dispose(bool disposing)

Dispose the HttpClient and Handlers.

protected void InitializeHttpClient(HttpClientHandler httpClientHandler, DelegatingHandler[] handlers)

Initializes HttpClient using HttpClientHandler.

protected void InitializeHttpClient(HttpClient httpClient, HttpClientHandler httpClientHandler, DelegatingHandler[] handlers)

Initialize service client with provided HttpClient

public virtual void SetRetryPolicy(RetryPolicy retryPolicy)

Sets retry policy for the client.

public bool SetUserAgent(string productName)

Sets the product name to be used in the user agent header when making requests

public bool SetUserAgent(string productName, string version)

Sets the product name and version to be used in the user agent header when making requests