public abstract class BaseClientService : IClientService, IDisposable
A base class for a client service which provides common mechanism for all services, like
serialization and GZip support. It should be safe to use a single service instance to make server requests
concurrently from multiple threads.
This class adds a special IHttpExecuteInterceptor to the
ConfigurableMessageHandler execute interceptor list, which uses the given
Authenticator. It calls to its applying authentication method, and injects the "Authorization" header in the
request.
If the given Authenticator implements IHttpUnsuccessfulResponseHandler, this
class adds the Authenticator to the ConfigurableMessageHandler's unsuccessful
response handler list.
Creates the back-off handler with ExponentialBackOff.
Overrides this method to change the default behavior of back-off handler (e.g. you can change the maximum
waited request's time span, or create a back-off handler with you own implementation of
IBackOff).
public void SetRequestSerailizedContent(HttpRequestMessage request, object body)
Sets the content of the request by the given body and the this service's configuration.
First the body object is serialized by the Serializer and then, if GZip is enabled, the content will be
wrapped in a GZip stream, otherwise a regular string stream will be used.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["`BaseClientService` is an abstract base class for client services, offering common functionalities like serialization and GZip support, and it is designed to be thread-safe for concurrent server requests."],["This class enhances `ConfigurableMessageHandler` with an `IHttpExecuteInterceptor` that applies authentication by injecting the \"Authorization\" header, and it also adds an `IHttpUnsuccessfulResponseHandler` for handling unsuccessful responses."],["`BaseClientService` offers various properties such as `ApiKey`, `ApplicationName`, `BasePath`, and `BaseUri` to manage service-related configurations, as well as it manages the `GZipEnabled` property, and the `HttpClient` for sending requests."],["This service class can handle both serializing and deserializing data, specifically the serialization of an object into a string representation using `SerializeObject`, and the deserialization of both normal responses using `DeserializeResponse\u003cT\u003e`, and errors using `DeserializeError`."],["The class includes methods like `CreateBackOffHandler` for customizing request retry behavior and `SetRequestSerailizedContent` for managing the request body content, also it allows setting a maximum URL length for GET requests via `DefaultMaxUrlLength`."]]],[]]