public async static Task <int> CountAsync <T, U>(this ICosmosDbRepository <T> repo, IList <U> partitionKeys, Expression <Func <T, bool> > predicate = null, Func <IQueryable <T>, IQueryable <T> > clauses = null, FeedOptions feedOptions = null)
        {
            var result = (await Task.WhenAll(
                              partitionKeys.Select(partitionKey => repo.CountAsync(predicate, clauses, SetPartitionKey(partitionKey, feedOptions)))))
                         .Aggregate((a, v) => a + v);

            return(result);
        }
Beispiel #2
0
 public static Task <int> CountAsync <T, U>(this ICosmosDbRepository <T> repo, U partitionKey, Expression <Func <T, bool> > predicate = null, Func <IQueryable <T>, IQueryable <T> > clauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.CountAsync(predicate, clauses, feedOptions));
 }