Ejemplo n.º 1
0
        private Dictionary <string, ExpectedAttributeValue> ToExpectedAttributeMap(DynamoDBEntryConversion conversion,
                                                                                   IEnumerable <string> epochAttributes, bool isEmptyStringValueEnabled)
        {
            Dictionary <string, ExpectedAttributeValue> ret = new Dictionary <string, ExpectedAttributeValue>();

            foreach (var kvp in ExpectedValues)
            {
                string        attributeName = kvp.Key;
                ExpectedValue expectedValue = kvp.Value;

                ExpectedAttributeValue eav;
                if (epochAttributes != null && epochAttributes.Contains(attributeName))
                {
                    var values = expectedValue.Values.Select(p => Document.DateTimeToEpochSeconds(p, attributeName)).ToList();
                    eav = ExpectedValue.ToExpectedAttributeValue(expectedValue.Exists, values, expectedValue.Comparison, conversion, isEmptyStringValueEnabled);
                }
                else
                {
                    eav = expectedValue.ToExpectedAttributeValue(conversion, isEmptyStringValueEnabled);
                }
                ret[attributeName] = eav;
            }

            return(ret);
        }
Ejemplo n.º 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);
        }