Class Table
- Namespace
- Amazon.DynamoDBv2.DocumentModel
- Assembly
- AWSSDK.DynamoDBv2.dll
The Table class is the starting object when using the Document API. It is used to Get documents from the DynamnoDB table and write documents back to the DynamoDB table.
public class Table
- Inheritance
-
Table
- Inherited Members
Properties
Attributes
List of key attributes on the table.
public List<AttributeDefinition> Attributes { get; set; }
Property Value
GlobalSecondaryIndexNames
Names of the global secondary indexes of the table.
public List<string> GlobalSecondaryIndexNames { get; }
Property Value
GlobalSecondaryIndexes
Global secondary indexes of the table.
public Dictionary<string, GlobalSecondaryIndexDescription> GlobalSecondaryIndexes { get; }
Property Value
HashKeys
List of keys on the table marked HASH
public List<string> HashKeys { get; }
Property Value
Keys
Keys of the table.
public Dictionary<string, KeyDescription> Keys { get; }
Property Value
LocalSecondaryIndexNames
Names of the local secondary indexes of the table.
public List<string> LocalSecondaryIndexNames { get; }
Property Value
LocalSecondaryIndexes
Local secondary indexes of the table.
public Dictionary<string, LocalSecondaryIndexDescription> LocalSecondaryIndexes { get; }
Property Value
RangeKeys
List of keys on the table marked RANGE
public List<string> RangeKeys { get; }
Property Value
TableName
Name of the table.
public string TableName { get; }
Property Value
Methods
ClearTableCache()
Clears current table cache. Next time a Table is created, its information will be loaded from DynamoDB.
public static void ClearTableCache()
CreateBatchGet()
Creates a DocumentBatchGet object for the current table, allowing a batch-get operation against DynamoDB.
public DocumentBatchGet CreateBatchGet()
Returns
- DocumentBatchGet
Empty DocumentBatchGet object.
CreateBatchWrite()
Creates a DocumentBatchWrite object for the current table, allowing a batch-put/delete operation against DynamoDB.
public DocumentBatchWrite CreateBatchWrite()
Returns
- DocumentBatchWrite
Empty DocumentBatchWrite object.
DeleteItemAsync(Document, DeleteItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(Document document, DeleteItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
documentDocumentDocument to delete.
configDeleteItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(Document, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(Document document, CancellationToken cancellationToken = default)
Parameters
documentDocumentDocument to delete.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(Primitive, DeleteItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(Primitive hashKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
configDeleteItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(Primitive, Primitive, DeleteItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(Primitive hashKey, Primitive rangeKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
rangeKeyPrimitiveRange key element of the document.
configDeleteItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(Primitive, Primitive, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
rangeKeyPrimitiveRange key element of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(Primitive, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(Primitive hashKey, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(IDictionary<string, DynamoDBEntry>, DeleteItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(IDictionary<string, DynamoDBEntry> key, DeleteItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
keyIDictionary<string, DynamoDBEntry>Key of the document.
configDeleteItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
DeleteItemAsync(IDictionary<string, DynamoDBEntry>, CancellationToken)
Initiates the asynchronous execution of the DeleteItem operation. Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem
public Task<Document> DeleteItemAsync(IDictionary<string, DynamoDBEntry> key, CancellationToken cancellationToken = default)
Parameters
keyIDictionary<string, DynamoDBEntry>Key of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
FromAttributeMap(Dictionary<string, AttributeValue>)
Creates a Document from an attribute map.
public Document FromAttributeMap(Dictionary<string, AttributeValue> data)
Parameters
dataDictionary<string, AttributeValue>Map of attribute names to attribute values.
Returns
- Document
Document representing the data.
GetItemAsync(Primitive, GetItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the GetItem operation. Amazon.DynamoDBv2.DocumentModel.Table.GetItem
public Task<Document> GetItemAsync(Primitive hashKey, GetItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
configGetItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
GetItemAsync(Primitive, Primitive, GetItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the GetItem operation. Amazon.DynamoDBv2.DocumentModel.Table.GetItem
public Task<Document> GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
rangeKeyPrimitiveRange key element of the document.
configGetItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
GetItemAsync(Primitive, Primitive, CancellationToken)
Initiates the asynchronous execution of the GetItem operation. Amazon.DynamoDBv2.DocumentModel.Table.GetItem
public Task<Document> GetItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
rangeKeyPrimitiveRange key element of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
GetItemAsync(Primitive, CancellationToken)
Initiates the asynchronous execution of the GetItem operation. Amazon.DynamoDBv2.DocumentModel.Table.GetItem
public Task<Document> GetItemAsync(Primitive hashKey, CancellationToken cancellationToken = default)
Parameters
hashKeyPrimitiveHash key element of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
GetItemAsync(IDictionary<string, DynamoDBEntry>, GetItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the GetItem operation. Amazon.DynamoDBv2.DocumentModel.Table.GetItem
public Task<Document> GetItemAsync(IDictionary<string, DynamoDBEntry> key, GetItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
keyIDictionary<string, DynamoDBEntry>Ley of the document.
configGetItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
GetItemAsync(IDictionary<string, DynamoDBEntry>, CancellationToken)
Initiates the asynchronous execution of the GetItem operation. Amazon.DynamoDBv2.DocumentModel.Table.GetItem
public Task<Document> GetItemAsync(IDictionary<string, DynamoDBEntry> key, CancellationToken cancellationToken = default)
Parameters
keyIDictionary<string, DynamoDBEntry>Ley of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
LoadTable(IAmazonDynamoDB, TableConfig)
Creates a Table object with the specified configuration, using the passed-in client to load the table definition.
This method will throw an exception if the table does not exist.
public static Table LoadTable(IAmazonDynamoDB ddbClient, TableConfig config)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
configTableConfigConfiguration to use for the table.
Returns
- Table
Table object representing the specified table.
LoadTable(IAmazonDynamoDB, string)
Creates a Table object with the specified name, using the passed-in client to load the table definition. The returned table will use the conversion specified by AWSConfigs.DynamoDBConfig.ConversionSchema
This method will throw an exception if the table does not exist.
public static Table LoadTable(IAmazonDynamoDB ddbClient, string tableName)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
Returns
- Table
Table object representing the specified table.
LoadTable(IAmazonDynamoDB, string, DynamoDBEntryConversion)
Creates a Table object with the specified name, using the passed-in client to load the table definition.
This method will throw an exception if the table does not exist.
public static Table LoadTable(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
conversionDynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
Returns
- Table
Table object representing the specified table.
LoadTable(IAmazonDynamoDB, string, DynamoDBEntryConversion, bool)
Creates a Table object with the specified name, using the passed-in client to load the table definition.
This method will throw an exception if the table does not exist.
public static Table LoadTable(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, bool isEmptyStringValueEnabled)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
conversionDynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
isEmptyStringValueEnabledboolIf the property is false, empty string values will be interpreted as null values.
Returns
- Table
Table object representing the specified table.
LoadTable(IAmazonDynamoDB, string, bool)
Creates a Table object with the specified name, using the passed-in client to load the table definition.
This method will throw an exception if the table does not exist.
public static Table LoadTable(IAmazonDynamoDB ddbClient, string tableName, bool isEmptyStringValueEnabled)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
isEmptyStringValueEnabledboolIf the property is false, empty string values will be interpreted as null values.
Returns
- Table
Table object representing the specified table.
PutItemAsync(Document, PutItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the PutItem operation. Amazon.DynamoDBv2.DocumentModel.Table.PutItem
public Task<Document> PutItemAsync(Document doc, PutItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
docDocumentDocument to save.
configPutItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
PutItemAsync(Document, CancellationToken)
Initiates the asynchronous execution of the PutItem operation. Amazon.DynamoDBv2.DocumentModel.Table.PutItem
public Task<Document> PutItemAsync(Document doc, CancellationToken cancellationToken = default)
Parameters
docDocumentDocument to save.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
Query(Primitive, Expression)
Initiates a Search object to Query a DynamoDB table, with the specified hash primary key and expression.
No calls are made until the Search object is used.
public Search Query(Primitive hashKey, Expression filterExpression)
Parameters
hashKeyPrimitiveValue of the hash key for the query operation.
filterExpressionExpressionExpression to use.
Returns
- Search
Resultant Search container.
Query(Primitive, QueryFilter)
Initiates a Search object to Query a DynamoDB table, with the specified hash primary key and filter.
No calls are made until the Search object is used.
public Search Query(Primitive hashKey, QueryFilter filter)
Parameters
hashKeyPrimitiveValue of the hash key for the query operation.
filterQueryFilterFilter to use.
Returns
- Search
Resultant Search container.
Query(QueryFilter)
Initiates a Search object to Query a DynamoDB table, with the specified filter.
No calls are made until the Search object is used.
public Search Query(QueryFilter filter)
Parameters
filterQueryFilterFilter to use.
Returns
- Search
Resultant Search container.
Query(QueryOperationConfig)
Initiates a Search object to Query a DynamoDB table, with the specified config.
No calls are made until the Search object is used.
public Search Query(QueryOperationConfig config)
Parameters
configQueryOperationConfigConfiguration to use.
Returns
- Search
Resultant Search container.
Scan(Expression)
Initiates a Search object to Scan a DynamoDB table, with the specified expression.
No calls are made until the Search object is used.
public Search Scan(Expression filterExpression)
Parameters
filterExpressionExpressionExpression to apply to the scan.
Returns
- Search
Resultant Search container.
Scan(ScanFilter)
Initiates a Search object to Scan a DynamoDB table, with the specified filter.
No calls are made until the Search object is used.
public Search Scan(ScanFilter filter)
Parameters
filterScanFilterFilter to apply to the scan.
Returns
- Search
Resultant Search container.
Scan(ScanOperationConfig)
Initiates a Search object to Scan a DynamoDB table, with the specified config.
No calls are made until the Search object is used.
public Search Scan(ScanOperationConfig config)
Parameters
configScanOperationConfigConfiguration to use.
Returns
- Search
Resultant Search container.
ToAttributeMap(Document)
Creates a map of attribute names mapped to AttributeValue objects. Converts .NET types using the conversion specified in this Table.
public Dictionary<string, AttributeValue> ToAttributeMap(Document doc)
Parameters
docDocument
Returns
ToAttributeUpdateMap(Document, bool)
Creates a map of attribute names mapped to AttributeValueUpdate objects.
public Dictionary<string, AttributeValueUpdate> ToAttributeUpdateMap(Document doc, bool changedAttributesOnly)
Parameters
docDocumentchangedAttributesOnlyboolIf true, only attributes that have been changed will be in the map.
Returns
ToExpectedAttributeMap(Document)
Creates a map of attribute names mapped to ExpectedAttributeValue objects.
public Dictionary<string, ExpectedAttributeValue> ToExpectedAttributeMap(Document doc)
Parameters
docDocument
Returns
TryLoadTable(IAmazonDynamoDB, TableConfig, out Table)
Creates a Table object with the specified configuration, using the passed-in client to load the table definition.
This method will return false if the table does not exist.
public static bool TryLoadTable(IAmazonDynamoDB ddbClient, TableConfig config, out Table table)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
configTableConfigConfiguration to use for the table.
tableTableLoaded table.
Returns
- bool
True if table was successfully loaded; otherwise false.
TryLoadTable(IAmazonDynamoDB, string, out Table)
Creates a Table object with the specified name, using the passed-in client to load the table definition. The returned table will use the conversion specified by AWSConfigs.DynamoDBConfig.ConversionSchema
This method will return false if the table does not exist.
public static bool TryLoadTable(IAmazonDynamoDB ddbClient, string tableName, out Table table)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
tableTableLoaded table.
Returns
- bool
True if table was successfully loaded; otherwise false.
TryLoadTable(IAmazonDynamoDB, string, DynamoDBEntryConversion, out Table)
Creates a Table object with the specified name, using the passed-in client to load the table definition.
This method will return false if the table does not exist.
public static bool TryLoadTable(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, out Table table)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
conversionDynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
tableTableLoaded table.
Returns
- bool
True if table was successfully loaded; otherwise false.
TryLoadTable(IAmazonDynamoDB, string, DynamoDBEntryConversion, bool, out Table)
Creates a Table object with the specified name, using the passed-in client to load the table definition.
This method will return false if the table does not exist.
public static bool TryLoadTable(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, bool isEmptyStringValueEnabled, out Table table)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
conversionDynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
isEmptyStringValueEnabledboolIf the property is false, empty string values will be interpreted as null values.
tableTableLoaded table.
Returns
- bool
True if table was successfully loaded; otherwise false.
TryLoadTable(IAmazonDynamoDB, string, bool, out Table)
Creates a Table object with the specified name, using the passed-in client to load the table definition.
This method will return false if the table does not exist.
public static bool TryLoadTable(IAmazonDynamoDB ddbClient, string tableName, bool isEmptyStringValueEnabled, out Table table)
Parameters
ddbClientIAmazonDynamoDBClient to use to access DynamoDB.
tableNamestringName of the table.
isEmptyStringValueEnabledboolIf the property is false, empty string values will be interpreted as null values.
tableTableLoaded table.
Returns
- bool
True if table was successfully loaded; otherwise false.
UpdateItemAsync(Document, Primitive, Primitive, UpdateItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
hashKeyPrimitiveHash key element of the document.
rangeKeyPrimitiveRange key element of the document.
configUpdateItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, Primitive, Primitive, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
hashKeyPrimitiveHash key element of the document.
rangeKeyPrimitiveRange key element of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, Primitive, UpdateItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, Primitive hashKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
hashKeyPrimitiveHash key element of the document.
configUpdateItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, Primitive, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, Primitive hashKey, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
hashKeyPrimitiveHash key element of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, UpdateItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, UpdateItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
configUpdateItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, IDictionary<string, DynamoDBEntry>, UpdateItemOperationConfig, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, IDictionary<string, DynamoDBEntry> key, UpdateItemOperationConfig config, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
keyIDictionary<string, DynamoDBEntry>Key of the document.
configUpdateItemOperationConfigConfiguration to use.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, IDictionary<string, DynamoDBEntry>, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, IDictionary<string, DynamoDBEntry> key, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
keyIDictionary<string, DynamoDBEntry>Key of the document.
cancellationTokenCancellationTokenToken which can be used to cancel the task.
Returns
UpdateItemAsync(Document, CancellationToken)
Initiates the asynchronous execution of the UpdateItem operation. Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem
public Task<Document> UpdateItemAsync(Document doc, CancellationToken cancellationToken = default)
Parameters
docDocumentAttributes to update.
cancellationTokenCancellationTokenToken which can be used to cancel the task.