Table of Contents

Class RequestOptions

Namespace
Microsoft.Azure.Cosmos
Assembly
Microsoft.Azure.Cosmos.Client.dll

The default cosmos request options

public class RequestOptions
Inheritance
RequestOptions
Derived
Inherited Members
Extension Methods

Constructors

RequestOptions()

public RequestOptions()

Properties

AddRequestHeaders

Gets or sets a delegate which injects/appends a custom header in the request.

public Action<Headers> AddRequestHeaders { get; set; }

Property Value

Action<Headers>

CosmosThresholdOptions

Threshold values for Distributed Tracing. These values decides whether to generate operation level EventSource with request diagnostics or not.

public CosmosThresholdOptions CosmosThresholdOptions { get; set; }

Property Value

CosmosThresholdOptions

ExcludeRegions

List of regions to be excluded routing the request to. This can be used to route a request to a specific region by excluding all other regions. If all regions are excluded, then the request will be routed to the primary/hub region.

public List<string> ExcludeRegions { get; set; }

Property Value

List<string>

IfMatchEtag

Gets or sets the If-Match (ETag) associated with the request in the Azure Cosmos DB service.

public string IfMatchEtag { get; set; }

Property Value

string

Remarks

Most commonly used with the Delete* and Replace* methods of Container such as ReplaceItemAsync<T>(T, string, PartitionKey?, ItemRequestOptions, CancellationToken).

IfNoneMatchEtag

Gets or sets the If-None-Match (ETag) associated with the request in the Azure Cosmos DB service.

public string IfNoneMatchEtag { get; set; }

Property Value

string

Remarks

Most commonly used to detect changes to the resource

PriorityLevel

Gets or sets the priority level for a request.

public PriorityLevel? PriorityLevel { get; set; }

Property Value

PriorityLevel?

Remarks

Setting priority level only has an effect if Priority Based Execution is enabled. If it is not enabled, the priority level is ignored by the backend. If AllowBulkExecution is set to true on CosmosClient, priority level set in RequestOptions is ignored. Default PriorityLevel for each request is treated as High. It can be explicitly set to Low for some requests. When Priority based execution is enabled, if there are more requests than the configured RU/S in a second, then Cosmos DB will throttle low priority requests to allow high priority requests to execute. This does not limit the throughput available to each priority level. Each priority level can consume the complete provisioned throughput in absence of the other. If both priorities are present and the user goes above the configured RU/s, low priority requests start getting throttled first to allow execution of mission critical workloads.

See Also

Properties

Application opted Cosmos request context that flow through with the RequestMessage. Context will be available through handlers.

public IReadOnlyDictionary<string, object> Properties { get; set; }

Property Value

IReadOnlyDictionary<string, object>

Methods

ShallowCopy()

Clone RequestOptions.

public RequestOptions ShallowCopy()

Returns

RequestOptions

cloned RequestOptions.