Beispiel #1
0
        public async Task <IReadOnlyList <T> > FindAllAsync(params IEnumerable <KeyValuePair <string, object> >[] keys)
        {
            if (keys is null || keys.Length == 0)
            {
                return(Array.Empty <T>());
            }

            var request = new BatchGetItemRequest(new TableKeys(tableName, keys));

            var result = await client.BatchGetItemAsync(request).ConfigureAwait(false);

            return(result.Responses[0].Select(i => i.As <T>(metadata)).ToArray());
        }
Beispiel #2
0
        public async Task <IReadOnlyList <T> > FindAllAsync(params IEnumerable <KeyValuePair <string, object> >[] keys)
        {
            if (keys is null || keys.Length == 0)
            {
                return(Array.Empty <T>());
            }

            var request = new BatchGetItemRequest(new TableKeys(tableName, keys));

            var result = await client.BatchGetItemAsync(request).ConfigureAwait(false);

            TableItemCollection r0 = result.Responses[0];

            var items = new T[r0.Count];

            for (int i = 0; i < items.Length; i++)
            {
                items[i] = r0[i].As <T>(metadata);
            }

            return(items);
        }
Beispiel #3
0
        public async Task <IReadOnlyList <T> > FindAllAsync(params IEnumerable <KeyValuePair <string, object> >[] keys)
        {
            #region Preconditions

            if (keys == null)
            {
                throw new ArgumentNullException(nameof(keys));
            }

            if (keys.Length == 0)
            {
                throw new ArgumentException("Must not be 0", paramName: "keys.Length");
            }

            #endregion

            var request = new BatchGetItemRequest(new TableKeys(tableName, keys));

            var result = await client.BatchGetItemAsync(request).ConfigureAwait(false);

            return(result.Responses[0].Select(i => i.As <T>(metadata)).ToArray());
        }