in RobotOrchestrator/CosmosDbClient.cs [191:216]
public async Task<T> GetItemAsync(string id, PartitionKey partitionKey)
{
ResourceResponse<Document> response;
try
{
response = await documentClient.ReadDocumentAsync(
UriFactory.CreateDocumentUri(dataBaseName, collectionName, id),
new RequestOptions { PartitionKey = partitionKey });
}
catch (DocumentClientException ex)
{
logger.LogError(ex.Message);
if (ex.StatusCode == HttpStatusCode.NotFound)
{
throw new RecordNotFoundException("Id not exists.", ex);
}
else
{
throw;
}
}
var item = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(response.Resource.ToString());
return item;
}