예제 #1
0
 public PutRequest(AttributeCollection item)
 {
     Item = item;
 }
예제 #2
0
 public DbValue(AttributeCollection map)
 {
     this.kind  = DbValueType.M;
     this.value = map;
 }
예제 #3
0
 public PutItemRequest(string tableName, AttributeCollection item)
 {
     TableName = tableName ?? throw new ArgumentNullException(nameof(tableName));
     Item      = item ?? throw new ArgumentNullException(nameof(item));
 }
예제 #4
0
 public DynamoExpression(JsonObject attributeNames, AttributeCollection attributeValues)
 {
     AttributeNames  = attributeNames;
     AttributeValues = attributeValues;
 }
예제 #5
0
        public Task <PutItemResult> PutAsync(T entity)
        {
            var request = new PutItemRequest(tableName, AttributeCollection.FromObject(entity, metadata));

            return(client.PutItemUsingRetryPolicyAsync(request, retryPolicy));
        }
예제 #6
0
 public GetItemResult(AttributeCollection item, ConsumedCapacity?consumedCapacity)
 {
     Item             = item;
     ConsumedCapacity = consumedCapacity;
 }
예제 #7
0
        public UpdateExpression(
            IEnumerable <Change> changes,
            JsonObject attributeNames,
            AttributeCollection attributeValues)
        {
            this.attributeNames  = attributeNames;
            this.attributeValues = attributeValues;

            foreach (var change in changes)
            {
                /*
                 * An update expression consists of sections.
                 * Each section begins with a SET, REMOVE, ADD or DELETE keyword.
                 * You can include any of these sections in an update expression in any order.
                 * However, each section keyword can appear only once.
                 */

                if (change.Operation == DataOperation.Remove)
                {
                    // REMOVE (attributes)
                    // e.g. REMOVE Title, RelatedItems[2], Pictures.RearView
                    // DELETE (elements in set)
                    // e.g. Color :c (deleted :c from color set)

                    if (change.Value == null)
                    {
                        // Remove attribute

                        if (remove == null)
                        {
                            remove = new StringBuilder("REMOVE ");
                        }

                        WriteChange(change, remove);
                    }
                    else
                    {
                        // Delete element
                        if (delete == null)
                        {
                            delete = new StringBuilder("DELETE ");
                        }

                        WriteChange(change, delete);
                    }
                }
                else if (change.Operation == DataOperation.Add)
                {
                    if (add == null)
                    {
                        add = new StringBuilder("ADD ");
                    }

                    WriteChange(change, add);
                }
                else if (change.Operation == DataOperation.Replace)
                {
                    if (set == null)
                    {
                        set = new StringBuilder("SET ");
                    }

                    WriteChange(change, set);
                }
                else
                {
                    throw new Exception("Unexpected change operation: " + change.Operation);
                }
            }
        }