/// <summary>
 /// Asynchronously returns one document given its id.
 /// </summary>
 /// <typeparam name="TDocument">The type representing a Document.</typeparam>
 /// <param name="id">The Id of the document you want to get.</param>
 /// <param name="partitionKey">An optional partition key.</param>
 public async Task <TDocument> GetByIdAsync <TDocument>(TKey id, string partitionKey = null) where TDocument : IDocument <TKey>
 {
     return(await MongoDbReader.GetByIdAsync <TDocument, TKey>(id, partitionKey));
 }
示例#2
0
 /// <summary>
 /// Asynchronously returns one document given its id.
 /// </summary>
 /// <typeparam name="TDocument">The type representing a Document.</typeparam>
 /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
 /// <param name="id">The Id of the document you want to get.</param>
 /// <param name="partitionKey">An optional partition key.</param>
 /// <param name="cancellationToken">An optional cancellation Token.</param>
 public async virtual Task <TDocument> GetByIdAsync <TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)
     where TDocument : IDocument <TKey>
     where TKey : IEquatable <TKey>
 {
     return(await MongoDbReader.GetByIdAsync <TDocument, TKey>(id, partitionKey, cancellationToken));
 }