예제 #1
0
 /// <summary>
 /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
 /// </summary>
 /// <typeparam name="TDocument">The document type.</typeparam>
 /// <typeparam name="TKey">The type of the primary key.</typeparam>
 /// <param name="filter">A LINQ expression filter.</param>
 /// <param name="maxValueSelector">A property selector to order by descending.</param>
 /// <param name="partitionKey">An optional partitionKey.</param>
 /// <param name="cancellationToken">An optional cancellation Token.</param>
 public async virtual Task <TDocument> GetByMaxAsync <TDocument, TKey>(
     Expression <Func <TDocument, bool> > filter,
     Expression <Func <TDocument, object> > maxValueSelector,
     string partitionKey = null, CancellationToken cancellationToken = default)
     where TDocument : IDocument <TKey>
     where TKey : IEquatable <TKey>
 {
     return(await MongoDbReader.GetByMaxAsync <TDocument, TKey>(filter, maxValueSelector, partitionKey, cancellationToken));
 }
 /// <summary>
 /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
 /// </summary>
 /// <typeparam name="TDocument">The document type.</typeparam>
 /// <param name="filter">A LINQ expression filter.</param>
 /// <param name="maxValueSelector">A property selector to order by descending.</param>
 /// <param name="partitionKey">An optional partitionKey.</param>
 public async Task <TDocument> GetByMaxAsync <TDocument>(Expression <Func <TDocument, bool> > filter, Expression <Func <TDocument, object> > maxValueSelector, string partitionKey = null)
     where TDocument : IDocument <TKey>
 {
     return(await MongoDbReader.GetByMaxAsync <TDocument, TKey>(filter, maxValueSelector, partitionKey));
 }