public async static Task <IList <T> > SelectAsync <T, V>(this ICosmosDbRepository <T> repo, IList <V> partitionKeys, string queryString, FeedOptions feedOptions = null)
        {
            var results = (await Task.WhenAll(
                               partitionKeys.Select(partitionKey => repo.SelectAsync <T>(queryString, SetPartitionKey(partitionKey, feedOptions)))))
                          .SelectMany(a => a);

            return(results?.ToList());
        }
示例#2
0
        public async Task <IActionResult> GetStoreMetadata(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = "metadata/stores")]
            HttpRequest req,
            ILogger log)
        {
            log.LogInformation($"C# HTTP trigger {nameof(GetStoreMetadata)} function processed a request.");

            var documents = await _storeRepository.SelectAsync(x => x.Name);

            var grouping = documents.GroupBy(x => x).SelectMany(x => x.Distinct());

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

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

            return(results?.ToList());
        }
示例#4
0
 public static Task <CosmosDbRepositoryPagedResults <U> > SelectAsync <T, U, V, W>(this ICosmosDbRepository <T> repo, W partitionKey, int pageSize, string continuationToken, Expression <Func <V, U> > selector, Func <IQueryable <T>, IQueryable <V> > whereClauses, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.SelectAsync(pageSize, continuationToken, selector, whereClauses, selectClauses, feedOptions));
 }
示例#5
0
 public static Task <IList <U> > SelectAsync <T, U, V, W>(this ICosmosDbRepository <T> repo, W partitionKey, Expression <Func <V, U> > selector, Func <IQueryable <T>, IQueryable <V> > whereClauses = null, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.SelectAsync(selector, whereClauses, selectClauses, feedOptions));
 }
示例#6
0
 public static Task <CosmosDbRepositoryPagedResults <U> > CrossPartitionSelectAsync <T, U>(this ICosmosDbRepository <T> repo, int pageSize, string continuationToken, Expression <Func <T, U> > selector, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetCrossPartition(feedOptions);
     return(repo.SelectAsync(pageSize, continuationToken, selector, selectClauses, feedOptions));
 }
示例#7
0
 public static Task <IList <U> > CrossPartitionSelectAsync <T, U>(this ICosmosDbRepository <T> repo, Expression <Func <T, U> > selector, Func <IQueryable <U>, IQueryable <U> > selectClauses = null, FeedOptions feedOptions = null)
 {
     feedOptions = SetCrossPartition(feedOptions);
     return(repo.SelectAsync(selector, selectClauses, feedOptions));
 }
 public static Task <CosmosDbRepositoryPagedResults <T> > SelectAsync <T, V>(this ICosmosDbRepository <T> repo, V partitionKey, int pageSize, string continuationToken, string queryString, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.SelectAsync <T>(pageSize, continuationToken, queryString, feedOptions));
 }
 public static Task <IList <T> > SelectAsync <T, V>(this ICosmosDbRepository <T> repo, V partitionKey, string queryString, FeedOptions feedOptions = null)
 {
     feedOptions = SetPartitionKey(partitionKey, feedOptions);
     return(repo.SelectAsync <T>(queryString, feedOptions));
 }
 public static Task <IList <T> > CrossPartitionSelectAsync <T>(this ICosmosDbRepository <T> repo, string queryString, FeedOptions feedOptions = null)
 {
     feedOptions = SetCrossPartition(feedOptions);
     return(repo.SelectAsync(queryString, feedOptions));
 }
 public static Task <CosmosDbRepositoryPagedResults <U> > CrossPartitionSelectAsync <T, U>(this ICosmosDbRepository <T> repo, int pageSize, string continuationToken, string queryString, FeedOptions feedOptions = null)
 {
     feedOptions = SetCrossPartition(feedOptions);
     return(repo.SelectAsync <U>(pageSize, continuationToken, queryString, feedOptions));
 }