Exemplo n.º 1
0
 /// <summary>
 /// Asynchronously returns one document given an expression filter.
 /// </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="filter">A LINQ expression filter.</param>
 /// <param name="partitionKey">An optional partition key.</param>
 /// <param name="cancellationToken">An optional cancellation Token.</param>
 public async virtual Task <TDocument> GetOneAsync <TDocument, TKey>(Expression <Func <TDocument, bool> > filter, string partitionKey = null, CancellationToken cancellationToken = default)
     where TDocument : IDocument <TKey>
     where TKey : IEquatable <TKey>
 {
     return(await MongoDbReader.GetOneAsync <TDocument, TKey>(filter, partitionKey, cancellationToken));
 }
 /// <summary>
 /// Asynchronously returns one document given an expression filter.
 /// </summary>
 /// <typeparam name="TDocument">The type representing a Document.</typeparam>
 /// <param name="filter">A LINQ expression filter.</param>
 /// <param name="partitionKey">An optional partition key.</param>
 public async Task <TDocument> GetOneAsync <TDocument>(Expression <Func <TDocument, bool> > filter, string partitionKey = null) where TDocument : IDocument <TKey>
 {
     return(await MongoDbReader.GetOneAsync <TDocument, TKey>(filter, partitionKey));
 }
 /// <summary>
 /// Asynchronously returns one document given filter definition.
 /// </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="condition">A mongodb filter definition.</param>
 /// <param name="findOption">A mongodb filter option.</param>
 /// <param name="partitionKey">An optional partition key.</param>
 /// <param name="cancellationToken">An optional cancellation Token.</param>
 public Task <TDocument> GetOneAsync <TDocument, TKey>(FilterDefinition <TDocument> condition, FindOptions findOption = null, string partitionKey = null,
                                                       CancellationToken cancellationToken = default) where TDocument : IDocument <TKey> where TKey : IEquatable <TKey>
 {
     return(MongoDbReader.GetOneAsync <TDocument, TKey>(condition, findOption, partitionKey, cancellationToken));
 }