Ejemplo n.º 1
0
        /// <summary>
        /// Gets records by partition key as an asynchronous operation.
        /// </summary>
        /// <param name="partitionKey">The partition key.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <param name="continuationTokenJson">The continuation token json.</param>
        /// <returns>Task&lt;PagedResult&lt;T&gt;&gt;.</returns>
        public async Task <PagedResult <T> > GetByPartitionKeyPagedAsync(string partitionKey, Func <T, bool> filter,
                                                                         int pageSize = 100,
                                                                         string continuationTokenJson = null)
        {
            var result = await _tableStore.GetByPartitionKeyPagedAsync(partitionKey, pageSize, continuationTokenJson)
                         .ConfigureAwait(false);

            return(CreatePagedResult(result, filter));
        }
        /// <inheritdoc />
        public async Task <IEnumerable <T> > FindAsync(string term, int pageSize = 10)
        {
            if (string.IsNullOrEmpty(term))
            {
                throw new ArgumentException(nameof(term));
            }

            if (pageSize < 0)
            {
                throw new ArgumentException(nameof(pageSize));
            }

            if (!_options.IsCaseSensitive)
            {
                term = term.ToLowerInvariant();
            }

            var results = await _tableStore.GetByPartitionKeyPagedAsync(term, pageSize).ConfigureAwait(false);

            return(results.Items.Select(
                       item => item.FromTableEntity <TrieEntry <T>, string, string>(x => x.Index, x => x.Key).Data));
        }