nerdexam
Microsoft

DP-420 · Question #56

You need to configure the consistency levels on a per-request basis. Which of the following C# class would you use in the .NET SDK for Azure Cosmos DB SQL API?

The correct answer is C. ItemRequestOptions. The correct answer is C: ItemRequestOptions. In the Azure Cosmos DB .NET SDK, consistency levels can be set at two levels: (1) client level - using CosmosClientOptions when building the CosmosClient (applies to all requests); (2) per-request level - using ItemRequestOptions…

Integrate an Azure Cosmos DB solution

Question

You need to configure the consistency levels on a per-request basis. Which of the following C# class would you use in the .NET SDK for Azure Cosmos DB SQL API?

Options

  • ACosmosClientOptions
  • BCosmosConfigOptions
  • CItemRequestOptions
  • DContainer

How the community answered

(35 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    89% (31)
  • D
    6% (2)

Explanation

The correct answer is C: ItemRequestOptions. In the Azure Cosmos DB .NET SDK, consistency levels can be set at two levels: (1) client level - using CosmosClientOptions when building the CosmosClient (applies to all requests); (2) per-request level - using ItemRequestOptions, which can be passed to individual item operations (ReadItemAsync, UpsertItemAsync, etc.) via its ConsistencyLevel property. ItemRequestOptions allows overriding the client-level consistency for a single request, which is exactly what is needed. CosmosClientOptions (option A) sets the default client-wide consistency, not per-request. CosmosConfigOptions (option B) does not exist as a standard SDK class. Container (option D) is the class representing a Cosmos DB container - it does not configure consistency levels directly.

Topics

#Consistency levels#.NET SDK#Request options#Data operations

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice