private static Dictionary <string, RequestSet> GetNextRequestItems(ref Dictionary <string, RequestSet> getRequestsMap, int maxNumberOfItems) { int numberOfItems = 0; var nextItems = new Dictionary <string, RequestSet>(); List <string> keys = new List <string>(getRequestsMap.Keys); foreach (string tableName in keys) { if (numberOfItems >= maxNumberOfItems) { break; } var getRequests = getRequestsMap[tableName]; if (getRequests.Count == 0) { continue; } var partialRequests = getRequests.RemoveFromHead(maxNumberOfItems - numberOfItems); var partialRequestsList = new RequestSet(partialRequests, getRequests.Batch); nextItems[tableName] = partialRequestsList; numberOfItems += partialRequestsList.Count; } return(nextItems); }
private Dictionary <string, RequestSet> ConvertBatches() { var allItems = new Dictionary <string, RequestSet>(); if (Batches == null || Batches.Count == 0) { return(allItems); } foreach (var batch in Batches) { var table = batch.TargetTable; var tableName = table.TableName; if (allItems.ContainsKey(tableName)) { throw new AmazonDynamoDBException("More than one batch request against a single table is not supported."); } if (batch.Keys != null && batch.Keys.Count > 0) { var keysList = batch.Keys.Select((Key k) => k as Dictionary <string, AttributeValue>); var keys = new RequestSet(keysList, batch); allItems.Add(tableName, keys); } } return(allItems); }
// PUT api/values/5 public void Put(int id, [FromBody] RequestSet request) { if (id == request.Id) { data.Entry(request).State = System.Data.Entity.EntityState.Modified; data.SaveChanges(); } }
// POST api/values public void Post([FromBody] RequestSet request) { data.RequestSet.Add(request); data.SaveChanges(); }