コード例 #1
0
        internal Document GetItemHelper(Key key, GetItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new GetItemOperationConfig();
            var request       = new GetItemRequest
            {
                TableName      = TableName,
                Key            = key,
                ConsistentRead = currentConfig.ConsistentRead
            };

            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(isAsync ?
                                                                                                new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                                                                                new RequestEventHandler(UserAgentRequestEventHandlerSync)
                                                                                                );
            if (currentConfig.AttributesToGet != null)
            {
                request.AttributesToGet = currentConfig.AttributesToGet;
            }

            var result       = DDBClient.GetItem(request);
            var attributeMap = result.Item;

            if (attributeMap == null || attributeMap.Count == 0)
            {
                return(null);
            }
            return(Document.FromAttributeMap(attributeMap));
        }
コード例 #2
0
        internal Document DeleteHelper(Key key, DeleteItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new DeleteItemOperationConfig();

            var req = new DeleteItemRequest
            {
                TableName = TableName,
                Key       = key
            };

            req.BeforeRequestEvent += isAsync ?
                                      new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                      new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumToStringMapper.Convert(currentConfig.ReturnValues);
            }
            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap();
            }

            var attributes = DDBClient.DeleteItem(req).Attributes;

            Document ret = null;

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(attributes);
            }
            return(ret);
        }
コード例 #3
0
        internal Document PutItemHelper(Document doc, PutItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new PutItemOperationConfig();

            PutItemRequest req = new PutItemRequest
            {
                TableName = TableName,
                Item      = doc.ToAttributeMap()
            };

            req.BeforeRequestEvent += isAsync ?
                                      new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                      new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap();
            }
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumToStringMapper.Convert(currentConfig.ReturnValues);
            }

            var resp = DDBClient.PutItem(req);

            doc.CommitChanges();

            Document ret = null;

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(resp.Attributes);
            }
            return(ret);
        }
コード例 #4
0
        internal Document UpdateHelper(Document doc, Key key, UpdateItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new UpdateItemOperationConfig();

            // If the keys have been changed, treat entire document as having changed
            bool haveKeysChanged             = HaveKeysChanged(doc);
            bool updateChangedAttributesOnly = !haveKeysChanged;

            var attributeUpdates = doc.ToAttributeUpdateMap(updateChangedAttributesOnly);

            foreach (var keyName in this.keyNames)
            {
                attributeUpdates.Remove(keyName);
            }

            UpdateItemRequest req = new UpdateItemRequest
            {
                TableName        = TableName,
                Key              = key,
                AttributeUpdates = attributeUpdates.Count == 0 ? null : attributeUpdates, // pass null if keys-only update
                ReturnValues     = EnumMapper.Convert(currentConfig.ReturnValues)
            };

            req.BeforeRequestEvent += isAsync ?
                                      new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                      new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.Expected != null && currentConfig.ExpectedState != null)
            {
                throw new InvalidOperationException("Expected and ExpectedState cannot be set at the same time");
            }
            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap();
            }
            if (currentConfig.ExpectedState != null &&
                currentConfig.ExpectedState.ExpectedValues != null &&
                currentConfig.ExpectedState.ExpectedValues.Count > 0)
            {
                req.Expected = currentConfig.ExpectedState.ToExpectedAttributeMap();
                if (req.Expected.Count > 1)
                {
                    req.ConditionalOperator = EnumMapper.Convert(currentConfig.ExpectedState.ConditionalOperator);
                }
            }

            var resp = DDBClient.UpdateItem(req);
            var returnedAttributes = resp.Attributes;

            doc.CommitChanges();

            Document ret = null;

            if (currentConfig.ReturnValues != ReturnValues.None)
            {
                ret = Document.FromAttributeMap(returnedAttributes);
            }
            return(ret);
        }
コード例 #5
0
        internal Document PutItemHelper(Document doc, PutItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new PutItemOperationConfig();

            PutItemRequest req = new PutItemRequest
            {
                TableName = TableName,
                Item      = doc.ToAttributeMap(Conversion)
            };

            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)req).AddBeforeRequestHandler(isAsync ?
                                                                                            new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                                                                            new RequestEventHandler(UserAgentRequestEventHandlerSync));

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumMapper.Convert(currentConfig.ReturnValues);
            }

            ValidateConditional(currentConfig);


            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap(Conversion);
            }
            else if (currentConfig.ExpectedState != null &&
                     currentConfig.ExpectedState.ExpectedValues != null &&
                     currentConfig.ExpectedState.ExpectedValues.Count > 0)
            {
                req.Expected = currentConfig.ExpectedState.ToExpectedAttributeMap(Conversion);
                if (req.Expected.Count > 1)
                {
                    req.ConditionalOperator = EnumMapper.Convert(currentConfig.ExpectedState.ConditionalOperator);
                }
            }
            else if (currentConfig.ConditionalExpression != null && currentConfig.ConditionalExpression.IsSet)
            {
                currentConfig.ConditionalExpression.ApplyExpression(req, this.Conversion);
            }

            var resp = DDBClient.PutItem(req);

            doc.CommitChanges();

            Document ret = null;

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(resp.Attributes);
            }
            return(ret);
        }
コード例 #6
0
        private void CallUntilCompletion(BatchWriteItemRequest request, Dictionary <string, Dictionary <Key, Document> > documentMap, IAmazonDynamoDB client)
#endif
        {
            do
            {
                var result = client.BatchWriteItem(request);
                request.RequestItems = result.UnprocessedItems;

                Dictionary <Key, Document> unprocessedDocuments = new Dictionary <Key, Document>(keyComparer);
                foreach (var unprocessedItems in result.UnprocessedItems)
                {
                    string tableName = unprocessedItems.Key;
                    Table  table     = tableMap[tableName];
                    Dictionary <Key, Document> tableDocumentMap = documentMap[tableName];

                    foreach (var writeRequest in unprocessedItems.Value)
                    {
                        if (writeRequest.PutRequest != null)
                        {
                            var key = table.MakeKey(Document.FromAttributeMap(writeRequest.PutRequest.Item));

                            Document document = null;
                            if (tableDocumentMap.TryGetValue(key, out document))
                            {
                                // Remove unprocessed requests from the document map
                                // and copy them to unprocessed documents.
                                unprocessedDocuments.Add(key, document);
                                tableDocumentMap.Remove(key);
                            }
                        }
                    }

                    // Commit the remaining documents in the document map
                    foreach (var document in tableDocumentMap.Values)
                    {
                        document.CommitChanges();
                    }
                    // Replace existing documents with just the unprocessed documents
                    documentMap[tableName] = unprocessedDocuments;
                }
            } while (request.RequestItems.Count > 0);

            // Commit any remaining documents in document map.
            // This would only happen if we are not able to match the items sent in the request
            // with the items returned back as unprocessed items.
            foreach (var tableDocumentMap in documentMap.Values)
            {
                foreach (var document in tableDocumentMap.Values)
                {
                    document.CommitChanges();
                }
            }
        }
コード例 #7
0
        internal Document DeleteHelper(Key key, DeleteItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new DeleteItemOperationConfig();

            var req = new DeleteItemRequest
            {
                TableName = TableName,
                Key       = key
            };

            req.BeforeRequestEvent += isAsync ?
                                      new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                      new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumMapper.Convert(currentConfig.ReturnValues);
            }

            ValidateConditional(currentConfig);

            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap(Conversion);
            }
            else if (currentConfig.ExpectedState != null &&
                     currentConfig.ExpectedState.ExpectedValues != null &&
                     currentConfig.ExpectedState.ExpectedValues.Count > 0)
            {
                req.Expected = currentConfig.ExpectedState.ToExpectedAttributeMap(Conversion);
                if (req.Expected.Count > 1)
                {
                    req.ConditionalOperator = EnumMapper.Convert(currentConfig.ExpectedState.ConditionalOperator);
                }
            }
            else if (currentConfig.ConditionalExpression != null && currentConfig.ConditionalExpression.IsSet)
            {
                currentConfig.ConditionalExpression.ApplyExpression(req, this.Conversion);
            }

            var attributes = DDBClient.DeleteItem(req).Attributes;

            Document ret = null;

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(attributes);
            }
            return(ret);
        }
コード例 #8
0
        internal Document PutItemHelper(Document doc, PutItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new PutItemOperationConfig();

            PutItemRequest req = new PutItemRequest
            {
                TableName = TableName,
                Item      = doc.ToAttributeMap()
            };

            req.BeforeRequestEvent += isAsync ?
                                      new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                      new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumMapper.Convert(currentConfig.ReturnValues);
            }
            if (currentConfig.Expected != null && currentConfig.ExpectedState != null)
            {
                throw new InvalidOperationException("Expected and ExpectedState cannot be set at the same time");
            }
            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap();
            }
            if (currentConfig.ExpectedState != null &&
                currentConfig.ExpectedState.ExpectedValues != null &&
                currentConfig.ExpectedState.ExpectedValues.Count > 0)
            {
                req.Expected = currentConfig.ExpectedState.ToExpectedAttributeMap();
                if (req.Expected.Count > 1)
                {
                    req.ConditionalOperator = EnumMapper.Convert(currentConfig.ExpectedState.ConditionalOperator);
                }
            }

            var resp = DDBClient.PutItem(req);

            doc.CommitChanges();

            Document ret = null;

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(resp.Attributes);
            }
            return(ret);
        }
コード例 #9
0
        internal Document DeleteHelper(Key key, DeleteItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new DeleteItemOperationConfig();

            var req = new DeleteItemRequest
            {
                TableName = TableName,
                Key       = key
            };

            req.BeforeRequestEvent += isAsync ?
                                      new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                      new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumMapper.Convert(currentConfig.ReturnValues);
            }
            if (currentConfig.Expected != null && currentConfig.ExpectedState != null)
            {
                throw new InvalidOperationException("Expected and ExpectedState cannot be set at the same time");
            }
            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap();
            }
            if (currentConfig.ExpectedState != null &&
                currentConfig.ExpectedState.ExpectedValues != null &&
                currentConfig.ExpectedState.ExpectedValues.Count > 0)
            {
                req.Expected = currentConfig.ExpectedState.ToExpectedAttributeMap();
                if (req.Expected.Count > 1)
                {
                    req.ConditionalOperator = EnumMapper.Convert(currentConfig.ExpectedState.ConditionalOperator);
                }
            }

            var attributes = DDBClient.DeleteItem(req).Attributes;

            Document ret = null;

            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(attributes);
            }
            return(ret);
        }
コード例 #10
0
        internal Dictionary <string, List <Document> > GetItemsHelper(bool isAsync)
        {
            var itemsAsDictionaries = GetAttributeItems(isAsync);
            var itemsAsDocuments    = new Dictionary <string, List <Document> >();

            foreach (var kvp in itemsAsDictionaries)
            {
                List <Document> documents = new List <Document>();
                foreach (var dictionary in kvp.Value)
                {
                    documents.Add(Document.FromAttributeMap(dictionary));
                }
                itemsAsDocuments[kvp.Key] = documents;
            }

            return(itemsAsDocuments);
        }
コード例 #11
0
 /// <summary>
 /// Creates a Document from an attribute map.
 /// </summary>
 /// <param name="data">Map of attribute names to attribute values.</param>
 /// <returns>Document representing the data.</returns>
 public Document FromAttributeMap(Dictionary <string, AttributeValue> data)
 {
     return(Document.FromAttributeMap(data, this.StoreAsEpoch));
 }
コード例 #12
0
        internal Document UpdateHelper(Document doc, Key key, UpdateItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new UpdateItemOperationConfig();

            // If the keys have been changed, treat entire document as having changed
            bool haveKeysChanged             = HaveKeysChanged(doc);
            bool updateChangedAttributesOnly = !haveKeysChanged;

            var attributeUpdates = doc.ToAttributeUpdateMap(Conversion, updateChangedAttributesOnly);

            foreach (var keyName in this.KeyNames)
            {
                attributeUpdates.Remove(keyName);
            }

            UpdateItemRequest req = new UpdateItemRequest
            {
                TableName        = TableName,
                Key              = key,
                AttributeUpdates = attributeUpdates.Count == 0 ? null : attributeUpdates, // pass null if keys-only update
                ReturnValues     = EnumMapper.Convert(currentConfig.ReturnValues)
            };


            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)req).AddBeforeRequestHandler(isAsync ?
                                                                                            new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                                                                            new RequestEventHandler(UserAgentRequestEventHandlerSync)
                                                                                            );

            ValidateConditional(currentConfig);

            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap(Conversion);
            }
            else if (currentConfig.ExpectedState != null &&
                     currentConfig.ExpectedState.ExpectedValues != null &&
                     currentConfig.ExpectedState.ExpectedValues.Count > 0)
            {
                req.Expected = currentConfig.ExpectedState.ToExpectedAttributeMap(Conversion);
                if (req.Expected.Count > 1)
                {
                    req.ConditionalOperator = EnumMapper.Convert(currentConfig.ExpectedState.ConditionalOperator);
                }
            }
            else if (currentConfig.ConditionalExpression != null && currentConfig.ConditionalExpression.IsSet)
            {
                currentConfig.ConditionalExpression.ApplyExpression(req, this.Conversion);

                string statement;
                Dictionary <string, AttributeValue> expressionAttributeValues;
                Dictionary <string, string>         expressionAttributeNames;
                Common.ConvertAttributeUpdatesToUpdateExpression(attributeUpdates, out statement, out expressionAttributeValues, out expressionAttributeNames);

                req.AttributeUpdates = null;
                req.UpdateExpression = statement;

                if (req.ExpressionAttributeValues == null)
                {
                    req.ExpressionAttributeValues = expressionAttributeValues;
                }
                else
                {
                    foreach (var kvp in expressionAttributeValues)
                    {
                        req.ExpressionAttributeValues.Add(kvp.Key, kvp.Value);
                    }
                }

                if (req.ExpressionAttributeNames == null)
                {
                    req.ExpressionAttributeNames = expressionAttributeNames;
                }
                else
                {
                    foreach (var kvp in expressionAttributeNames)
                    {
                        req.ExpressionAttributeNames.Add(kvp.Key, kvp.Value);
                    }
                }
            }

            var resp = DDBClient.UpdateItem(req);
            var returnedAttributes = resp.Attributes;

            doc.CommitChanges();

            Document ret = null;

            if (currentConfig.ReturnValues != ReturnValues.None)
            {
                ret = Document.FromAttributeMap(returnedAttributes);
            }
            return(ret);
        }
コード例 #13
0
        private List <Document> GetNextSetHelper(bool isAsync)
        {
            List <Document> ret = new List <Document>();

            if (!IsDone)
            {
                switch (SearchMethod)
                {
                case SearchType.Scan:
                    ScanRequest scanReq = new ScanRequest
                    {
                        ExclusiveStartKey = NextKey,
                        Limit             = Limit,
                        TableName         = TableName,
                        AttributesToGet   = AttributesToGet,
                        ScanFilter        = Filter,
                        Select            = EnumToStringMapper.Convert(Select)
                    };

                    if (this.TotalSegments != 0)
                    {
                        scanReq.TotalSegments = this.TotalSegments;
                        scanReq.Segment       = this.Segment;
                    }

                    scanReq.BeforeRequestEvent += isAsync ?
                                                  new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerAsync) :
                                                  new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerSync);

                    ScanResult scanResult = SourceTable.DDBClient.Scan(scanReq).ScanResult;
                    foreach (var item in scanResult.Items)
                    {
                        Document doc = Document.FromAttributeMap(item);
                        ret.Add(doc);
                        Matches.Add(doc);
                    }
                    NextKey = scanResult.LastEvaluatedKey;
                    if (NextKey == null)
                    {
                        IsDone = true;
                    }
                    return(ret);

                case SearchType.Query:
                    QueryRequest queryReq = new QueryRequest
                    {
                        ConsistentRead    = IsConsistentRead,
                        ExclusiveStartKey = NextKey,
                        Limit             = Limit,
                        ScanIndexForward  = !IsBackwardSearch,
                        TableName         = TableName,
                        AttributesToGet   = AttributesToGet,
                        KeyConditions     = Filter,
                        IndexName         = IndexName,
                        Select            = EnumToStringMapper.Convert(Select)
                    };
                    queryReq.BeforeRequestEvent += isAsync ?
                                                   new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerAsync) :
                                                   new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerSync);

                    QueryResult queryResult = SourceTable.DDBClient.Query(queryReq).QueryResult;
                    foreach (var item in queryResult.Items)
                    {
                        Document doc = Document.FromAttributeMap(item);
                        ret.Add(doc);
                        Matches.Add(doc);
                    }
                    NextKey = queryResult.LastEvaluatedKey;
                    if (NextKey == null)
                    {
                        IsDone = true;
                    }
                    return(ret);

                default:
                    throw new InvalidOperationException("Unknown Search Method");
                }
            }

            return(ret);
        }
コード例 #14
0
        internal List <Document> GetNextSetHelper(bool isAsync)
        {
            List <Document> ret = new List <Document>();

            if (!IsDone)
            {
                switch (SearchMethod)
                {
                case SearchType.Scan:
                    ScanRequest scanReq = new ScanRequest
                    {
                        ExclusiveStartKey = NextKey,
                        Limit             = Limit,
                        TableName         = TableName,
                        AttributesToGet   = AttributesToGet,
                        ScanFilter        = Filter.ToConditions(SourceTable.Conversion),
                        Select            = EnumMapper.Convert(Select),
                    };
                    if (!string.IsNullOrEmpty(this.IndexName))
                    {
                        scanReq.IndexName = this.IndexName;
                    }
                    if (this.FilterExpression != null && this.FilterExpression.IsSet)
                    {
                        this.FilterExpression.ApplyExpression(scanReq, SourceTable.Conversion);
                    }
                    if (scanReq.ScanFilter != null && scanReq.ScanFilter.Count > 1)
                    {
                        scanReq.ConditionalOperator = EnumMapper.Convert(ConditionalOperator);
                    }
                    Common.ConvertAttributesToGetToProjectionExpression(scanReq);

                    if (this.TotalSegments != 0)
                    {
                        scanReq.TotalSegments = this.TotalSegments;
                        scanReq.Segment       = this.Segment;
                    }

                    ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)scanReq).AddBeforeRequestHandler(isAsync ?
                                                                                                        new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerAsync) :
                                                                                                        new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerSync)
                                                                                                        );

                    var scanResult = SourceTable.DDBClient.Scan(scanReq);
                    foreach (var item in scanResult.Items)
                    {
                        Document doc = Document.FromAttributeMap(item);
                        ret.Add(doc);
                        if (CollectResults)
                        {
                            Matches.Add(doc);
                        }
                    }
                    NextKey = scanResult.LastEvaluatedKey;
                    if (NextKey == null || NextKey.Count == 0)
                    {
                        IsDone = true;
                    }
                    return(ret);

                case SearchType.Query:
                    QueryRequest queryReq = new QueryRequest
                    {
                        TableName         = TableName,
                        ConsistentRead    = IsConsistentRead,
                        Select            = EnumMapper.Convert(Select),
                        ExclusiveStartKey = NextKey,
                        Limit             = Limit,
                        ScanIndexForward  = !IsBackwardSearch,
                        AttributesToGet   = AttributesToGet,
                        IndexName         = IndexName,
                    };

                    if (this.FilterExpression != null && this.FilterExpression.IsSet)
                    {
                        this.FilterExpression.ApplyExpression(queryReq, SourceTable.Conversion);
                    }

                    Dictionary <string, Condition> keyConditions, filterConditions;
                    SplitQueryFilter(Filter, SourceTable, queryReq.IndexName, out keyConditions, out filterConditions);
                    queryReq.KeyConditions = keyConditions;
                    queryReq.QueryFilter   = filterConditions;
                    Common.ConvertAttributesToGetToProjectionExpression(queryReq);

                    if (queryReq.QueryFilter != null && queryReq.QueryFilter.Count > 1)
                    {
                        queryReq.ConditionalOperator = EnumMapper.Convert(ConditionalOperator);
                    }

                    ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)queryReq).AddBeforeRequestHandler(isAsync ?
                                                                                                         new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerAsync) :
                                                                                                         new RequestEventHandler(SourceTable.UserAgentRequestEventHandlerSync)
                                                                                                         );
                    var queryResult = SourceTable.DDBClient.Query(queryReq);
                    foreach (var item in queryResult.Items)
                    {
                        Document doc = Document.FromAttributeMap(item);
                        ret.Add(doc);
                        if (CollectResults)
                        {
                            Matches.Add(doc);
                        }
                    }
                    NextKey = queryResult.LastEvaluatedKey;
                    if (NextKey == null || NextKey.Count == 0)
                    {
                        IsDone = true;
                    }
                    return(ret);

                default:
                    throw new InvalidOperationException("Unknown Search Method");
                }
            }

            return(ret);
        }