You are developing a C# application using the Azure Cosmos DB .NET SDK v3 to manage document collaboration sessions. The container is configured with a partition key path of `/documentId`. The Azure Cosmos DB account is configured with the default consistency level of Session.
An update to a document is processed by Web App Instance A using the following code:
csharp
ItemResponse<Document> writeResponse = await container.ReplaceItemAsync<Document>(
updatedDocument,
updatedDocument.Id,
new PartitionKey(updatedDocument.DocumentId)
);
string token = writeResponse.Headers.Session;
Immediately after the update, Web App Instance B (which runs on a separate virtual machine and utilizes a different `CosmosClient` instance) needs to read the same document to display the latest updates to the same user.
Which C# code segment should you execute on Web App Instance B to guarantee a read-your-writes consistency guarantee for this operation?
- AItemRequestOptions options = new ItemRequestOptions
{
ConsistencyLevel = ConsistencyLevel.Session
};
ItemResponse<Document> readResponse = await container.ReadItemAsync<Document>(
documentId,
new PartitionKey(documentId),
options
); - BItemResponse<Document> readResponse = await container.ReadItemAsync<Document>(
documentId,
new PartitionKey(documentId)
); - ItemRequestOptions options = new ItemRequestOptions
{
SessionToken = token
};
ItemResponse<Document> readResponse = await container.ReadItemAsync<Document>(
documentId,
new PartitionKey(documentId),
options
);Cevap - DItemRequestOptions options = new ItemRequestOptions
{
SessionToken = token
};
ItemResponse<Document> readResponse = await container.ReadItemAsync<Document>(
documentId,
new PartitionKey(userStatus),
options
);