public async static Task <IList <U> > SelectManyAsync <T, U, V>(this ICosmosDbRepository <T> repo, IList <V> partitionKeys, Expression <Func <T, IEnumerable <U> > > selector, Func <IQueryable <T>, IQueryable <T> > whereClauses = null, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
        {
            var results = (await Task.WhenAll(
                               partitionKeys.Select(partitionKey => repo.SelectManyAsync(selector, whereClauses, selectClauses, SetPartitionKey(partitionKey, feedOptions)))))
                          .SelectMany(a => a);

            if (results != default && selectClauses != default)
            {
                results = selectClauses.Invoke(results.AsQueryable());
            }

            return(results?.ToList());
        }
예제 #2
0
 public static Task <CosmosDbRepositoryPagedResults <U> > SelectManyAsync <T, U, V>(this ICosmosDbRepository <T> repo, V partitionKey, int pageSize, string continuationToken, Expression <Func <T, IEnumerable <U> > > selector, Func <IQueryable <T>, IQueryable <T> > whereClauses = null, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.SelectManyAsync(pageSize, continuationToken, selector, whereClauses, selectClauses, feedOptions));
 }
예제 #3
0
 public static Task <IList <U> > SelectManyAsync <T, U, V>(this ICosmosDbRepository <T> repo, V partitionKey, Expression <Func <T, IEnumerable <U> > > selector, Func <IQueryable <T>, IQueryable <T> > whereClauses = null, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.SelectManyAsync(selector, whereClauses, selectClauses, feedOptions));
 }