AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

A collection of attribute key-value pairs that defines an item in DynamoDB.

Inheritance Hierarchy

System.Object
  Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry
    Amazon.DynamoDBv2.DocumentModel.Document

Namespace: Amazon.DynamoDBv2.DocumentModel
Assembly: AWSSDK.DynamoDBv2.dll
Version: 3.x.y.z

Syntax

C#
public class Document : DynamoDBEntry
         ICloneable, ICollection<KeyValuePair<String, DynamoDBEntry>>, IDictionary<String, DynamoDBEntry>, IEnumerable, IEnumerable<KeyValuePair<String, DynamoDBEntry>>

The Document type exposes the following members

Constructors

NameDescription
Public Method Document()

Constructs an empty Document.

Public Method Document(Dictionary<String, DynamoDBEntry>)

Constructs a Document with the passed-in values as its attribute values.

Properties

NameTypeDescription
Public Property Count System.Int32

Gets the count of attributes.

Public Property IsReadOnly System.Boolean

Returns true if the document is read only.

Public Property Item Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry
Public Property Keys System.Collections.Generic.ICollection<System.String>

This list of attribute keys for the document.

Public Property Values System.Collections.Generic.ICollection<Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry>

Get a list of all the values in the Document.

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method Add(string, DynamoDBEntry)

Add value to Doucment.

Public Method Add(KeyValuePair<String, DynamoDBEntry>)

Add attributes to Document.

Public Method AsArrayOfDynamoDBEntry() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsArrayOfPrimitive() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsArrayOfString() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsBoolean() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsByte() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsByteArray() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsChar() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDateTime() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDateTimeUtc() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDecimal() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDocument() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDouble() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDynamoDBBool() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDynamoDBList() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsDynamoDBNull() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsGuid() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsHashSetOfByteArray() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsHashSetOfDynamoDBEntry() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsHashSetOfMemoryStream() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsHashSetOfPrimitive() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsHashSetOfString() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsInt() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsListOfByteArray() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsListOfDocument() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsListOfDynamoDBEntry() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsListOfMemoryStream() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsListOfPrimitive() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsListOfString() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsLong() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsMemoryStream() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsPrimitive() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsPrimitiveList() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsSByte() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsShort() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsSingle() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsString() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsUInt() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsULong() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method AsUShort() Inherited from Amazon.DynamoDBv2.DocumentModel.DynamoDBEntry.
Public Method Clear()

Clear attributes from document.

Public Method Clone()

Clones the Document

Public Method Contains(string)

Determines if a specific attribute is set on the Document.

Public Method Contains(KeyValuePair<String, DynamoDBEntry>)

Check to see if the attributes are in the Document.

Public Method ContainsKey(string)

Check to see if the value is set on the document.

Public Method CopyTo(KeyValuePair`2[], int)
Public Method DecodeBase64Attributes(String[])

Decodes root-level Base64-encoded strings to their binary representations. Use this method if the Document was constructed from JSON that contains base64-encoded binary values, which result from calling ToJson on a Document with binary data.

Individual strings become binary data. List and sets of Base64-encoded strings become lists and sets of binary data.

Public Method ForceConversion(DynamoDBEntryConversion)

Returns a new instance of Document where all unconverted .NET types are converted to DynamoDBEntry types using a specific conversion.

Public Method Static Method FromAttributeMap(Dictionary<String, AttributeValue>)

Creates a Document from an attribute map.

Public Method Static Method FromJson(string)

Creates a document from a JSON string. The conversion is as follows: Objects are converted to DynamoDB M types. Arrays are converted to DynamoDB L types. Boolean types are converted to DynamoDB BOOL types. Null values are converted to DynamoDB NULL types. Numerics are converted to DynamoDB N types. Strings are converted to DynamoDB S types.

Public Method Static Method FromJsonArray(string)

Parses JSON text to produce an array of Amazon.DynamoDBv2.DocumentModel.Document.

Public Method GetAttributeNames()

Returns the names of all the attributes.

Public Method GetEnumerator()

Gets the enumerator for the attributes.

Public Method IsAttributeChanged(string)

Returns true if the attribute has been changed.

Public Method IsDirty()

Returns true if the document contains attributes that have not been saved.

Public Method Remove(string)

Remove the attribute from the Document.

Public Method Remove(KeyValuePair<String, DynamoDBEntry>)

Removes the attributes from the document.

Public Method ToAttributeMap()

Creates a map of attribute names mapped to AttributeValue objects. Converts .NET types using the conversion specified by AWSConfigs.DynamoDBConfig.ConversionSchema

Public Method ToAttributeMap(DynamoDBEntryConversion)

Creates a map of attribute names mapped to AttributeValue objects.

Public Method ToAttributeMap(DynamoDBEntryConversion, bool)

Creates a map of attribute names mapped to AttributeValue objects.

Public Method ToAttributeUpdateMap(bool)

Creates a map of attribute names mapped to AttributeValueUpdate objects.

Public Method ToAttributeUpdateMap(DynamoDBEntryConversion, bool)

Creates a map of attribute names mapped to AttributeValueUpdate objects.

Public Method ToAttributeUpdateMap(DynamoDBEntryConversion, bool, bool)

Creates a map of attribute names mapped to AttributeValueUpdate objects.

Public Method ToExpectedAttributeMap()

Creates a map of attribute names mapped to ExpectedAttributeValue objects.

Public Method ToExpectedAttributeMap(DynamoDBEntryConversion)

Creates a map of attribute names mapped to ExpectedAttributeValue objects.

Public Method ToExpectedAttributeMap(DynamoDBEntryConversion, bool)

Creates a map of attribute names mapped to ExpectedAttributeValue objects.

Public Method ToJson()

Converts the current Document into a matching JSON string.

DynamoDB types are a superset of JSON types, thus the following DynamoDB cannot be properly represented as JSON data: PrimitiveList (SS, NS, BS types) - these sets will be converted to JSON arrays Binary Primitive (B type) - binary data will be converted to Base64 strings

If the resultant JSON is passed to Document.FromJson, the binary values will be treated as Base64 strings. Invoke Document.DecodeBase64Attributes to decode these strings into binary data.

Public Method ToJsonPretty()

Converts the current Document into a matching pretty JSON string.

DynamoDB types are a superset of JSON types, thus the following DynamoDB cannot be properly represented as JSON data: PrimitiveList (SS, NS, BS types) - these sets will be converted to JSON arrays Binary Primitive (B type) - binary data will be converted to Base64 strings

If the resultant JSON is passed to Document.FromJson, the binary values will be treated as Base64 strings. Invoke Document.DecodeBase64Attributes to decode these strings into binary data.

Public Method TryGetValue(string, out DynamoDBEntry)

Gets the value associated with the specified attribute value.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5