Exemple #1
0
        internal override ExpectedAttributeValue ConvertToExpectedAttributeValue()
        {
            ExpectedAttributeValue expectedAttribute = new ExpectedAttributeValue();

            if ((Entries != null) && (Entries.Count != 0))
            {
                expectedAttribute.Exists = true;
                expectedAttribute.Value  = new AttributeValue();
                List <string> values = new List <string>();
                foreach (var entry in Entries)
                {
                    values.Add(entry.Value);
                }
                if (SaveAsNumeric)
                {
                    expectedAttribute.Value.NS = values;
                }
                else
                {
                    expectedAttribute.Value.SS = values;
                }
            }
            else
            {
                expectedAttribute.Exists = false;
            }

            return(expectedAttribute);
        }
Exemple #2
0
        /// <summary>
        /// Creates a map of attribute names mapped to ExpectedAttributeValue objects.
        /// </summary>
        /// <param name="conversion">Conversion to use for converting .NET values to DynamoDB values.</param>
        /// <returns></returns>
        public Dictionary <string, ExpectedAttributeValue> ToExpectedAttributeMap(DynamoDBEntryConversion conversion)
        {
            Dictionary <string, ExpectedAttributeValue> ret = new Dictionary <string, ExpectedAttributeValue>();

            foreach (var kvp in ExpectedValues)
            {
                string                 attributeName = kvp.Key;
                ExpectedValue          expectedValue = kvp.Value;
                ExpectedAttributeValue eav           = expectedValue.ToExpectedAttributeValue(conversion);
                ret[attributeName] = eav;
            }

            return(ret);
        }
Exemple #3
0
        public int Insert(Data.DataAspect aspect, IEnumerable <AspectMemberValue> values, out object identityValue)
        {
            identityValue = null;
            return(0);

            PutItemRequest request = new PutItemRequest();

            foreach (AspectMemberValue amv in values)
            {
                ExpectedAttributeValue eav = new ExpectedAttributeValue();
                eav.Value = new AttributeValue();
                request.Expected.Add(aspect[amv.Ordinal].StoredName, eav);
            }
        }
        internal ExpectedAttributeValue ConvertToExpectedAttributeValue()
        {
            AttributeValue attributeValue = ConvertToAttributeValue();

            ExpectedAttributeValue expectedAttribute = new ExpectedAttributeValue();

            if (attributeValue == null)
            {
                expectedAttribute.Exists = false;
            }
            else
            {
                expectedAttribute.Exists = true;
                expectedAttribute.Value  = attributeValue;
            }

            return(expectedAttribute);
        }
Exemple #5
0
        /// <summary>
        /// Converts this ExpectedValue instance to Amazon.DynamoDBv2.Model.ExpectedAttributeValue
        /// </summary>
        /// <param name="conversion">Conversion to use for converting .NET values to DynamoDB values.</param>
        /// <returns>Amazon.DynamoDBv2.Model.ExpectedAttributeValue</returns>
        public ExpectedAttributeValue ToExpectedAttributeValue(DynamoDBEntryConversion conversion)
        {
            var eav = new ExpectedAttributeValue();

            if (this.Exists)
            {
                eav.ComparisonOperator = EnumMapper.Convert(this.Comparison);
                foreach (var val in this.Values)
                {
                    eav.AttributeValueList.Add(val.ConvertToAttributeValue(new DynamoDBEntry.AttributeConversionConfig(conversion)));
                }
            }
            else
            {
                eav.Exists = this.Exists;
            }

            return(eav);
        }
Exemple #6
0
        /// <summary>
        /// Converts this ExpectedValue instance to Amazon.DynamoDBv2.Model.ExpectedAttributeValue
        /// </summary>
        /// <returns>Amazon.DynamoDBv2.Model.ExpectedAttributeValue</returns>
        public ExpectedAttributeValue ToExpectedAttributeValue()
        {
            var eav = new ExpectedAttributeValue();

            if (this.Exists)
            {
                eav.ComparisonOperator = EnumMapper.Convert(this.Comparison);
                foreach (var val in this.Values)
                {
                    eav.AttributeValueList.Add(val.ConvertToAttributeValue());
                }
            }
            else
            {
                eav.Exists = this.Exists;
            }

            return(eav);
        }
        internal static ExpectedAttributeValue ToExpectedAttributeValue(bool exists, IEnumerable <DynamoDBEntry> values, ScanOperator comparison,
                                                                        DynamoDBEntryConversion conversion)
        {
            var eav = new ExpectedAttributeValue();

            if (exists)
            {
                eav.ComparisonOperator = EnumMapper.Convert(comparison);
                foreach (var val in values)
                {
                    eav.AttributeValueList.Add(val.ConvertToAttributeValue(new DynamoDBEntry.AttributeConversionConfig(conversion)));
                }
            }
            else
            {
                eav.Exists = exists;
            }

            return(eav);
        }
Exemple #8
0
        internal override ExpectedAttributeValue ConvertToExpectedAttributeValue()
        {
            ExpectedAttributeValue expectedAttribute = new ExpectedAttributeValue();

            if (!string.IsNullOrEmpty(this.Value))
            {
                expectedAttribute.Exists = true;
                expectedAttribute.Value  = new AttributeValue();
                if (SaveAsNumeric)
                {
                    expectedAttribute.Value.N = Value;
                }
                else
                {
                    expectedAttribute.Value.S = Value;
                }
            }
            else
            {
                expectedAttribute.Exists = false;
            }

            return(expectedAttribute);
        }