Exemple #1
0
        public async Task <BatchGetItemResult> BatchGetItemAsync(BatchGetItemRequest request)
        {
            var httpRequest = Setup("BatchGetItem", request.ToJson());

            var json = await SendAndReadJsonElementAsync(httpRequest).ConfigureAwait(false);

            return(BatchGetItemResult.FromJsonElement(json));
        }
Exemple #2
0
        public async Task <BatchGetItemResult> BatchGetItemAsync(BatchGetItemRequest request)
        {
            var httpRequest = Setup("BatchGetItem", request.ToJson());

            var responseText = await SendAsync(httpRequest).ConfigureAwait(false);

            var responseJson = JsonObject.Parse(responseText);

            return(BatchGetItemResult.FromJson(responseJson));
        }
Exemple #3
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());
        }
Exemple #4
0
        public async Task <IList <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.BatchGetItem(request).ConfigureAwait(false);

            return(result.Responses[0].Select(i => i.As <T>(metadata)).ToArray());
        }
Exemple #5
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);
        }