Exemple #1
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 static Document FromAttributeMap(Dictionary <string, AttributeValue> data)
        {
            Document doc = new Document();

            if (data != null)
            {
                // Add Primitives and PrimitiveLists
                foreach (var attribute in data)
                {
                    string         wholeKey = attribute.Key;
                    AttributeValue value    = attribute.Value;

                    DynamoDBEntry convertedValue = AttributeValueToDynamoDBEntry(value);
                    if (convertedValue != null)
                    {
                        doc.currentValues[wholeKey] = convertedValue;
                    }
                }
            }

            doc.CommitChanges();
            return(doc);
        }
 /// <summary>
 /// Gets the value associated with the specified attribute value.
 /// </summary>
 /// <param name="attributeName">Attribute name</param>
 /// <param name="entry">
 /// If the specified attribute value is found, returns the value associated with the 
 /// attribute; otherwise, null.
 /// </param>
 /// <returns>True if attribute is found; false otherwise</returns>
 public bool TryGetValue(string attributeName, out DynamoDBEntry entry)
 {
     return this.currentValues.TryGetValue(attributeName, out entry);
 }
        public object FromEntry(DynamoDBEntry entry)
        {
            Primitive primitive = entry as Primitive;
            if (primitive == null) return null;

            if (primitive.Type != DynamoDBEntryType.String) throw new InvalidCastException();
            string xml = primitive.AsString();
            using (StringReader reader = new StringReader(xml))
            {
                return _serializer.Deserialize(reader);
            }
        }
Exemple #4
0
 /// <summary>
 /// Gets the value associated with the specified attribute value.
 /// </summary>
 /// <param name="attributeName">Attribute name</param>
 /// <param name="entry">
 /// If the specified attribute value is found, returns the value associated with the
 /// attribute; otherwise, null.
 /// </param>
 /// <returns>True if attribute is found; false otherwise</returns>
 public bool TryGetValue(string attributeName, out DynamoDBEntry entry)
 {
     return(this.currentValues.TryGetValue(attributeName, out entry));
 }