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
document
DocumentDocument to delete.
config
DeleteItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
document
DocumentDocument to delete.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
config
DeleteItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
rangeKey
PrimitiveRange key element of the document.
config
DeleteItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
rangeKey
PrimitiveRange key element of the document.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
cancellationToken
CancellationTokenToken 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
key
IDictionary<string, DynamoDBEntry>Key of the document.
config
DeleteItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
key
IDictionary<string, DynamoDBEntry>Key of the document.
cancellationToken
CancellationTokenToken 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
data
Dictionary<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
hashKey
PrimitiveHash key element of the document.
config
GetItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
rangeKey
PrimitiveRange key element of the document.
config
GetItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
rangeKey
PrimitiveRange key element of the document.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveHash key element of the document.
cancellationToken
CancellationTokenToken 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
key
IDictionary<string, DynamoDBEntry>Ley of the document.
config
GetItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
key
IDictionary<string, DynamoDBEntry>Ley of the document.
cancellationToken
CancellationTokenToken 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
config
TableConfigConfiguration 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
conversion
DynamoDBEntryConversionConversion 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
conversion
DynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
isEmptyStringValueEnabled
boolIf 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
isEmptyStringValueEnabled
boolIf 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
doc
DocumentDocument to save.
config
PutItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
doc
DocumentDocument to save.
cancellationToken
CancellationTokenToken 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
hashKey
PrimitiveValue of the hash key for the query operation.
filterExpression
ExpressionExpression 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
hashKey
PrimitiveValue of the hash key for the query operation.
filter
QueryFilterFilter 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
filter
QueryFilterFilter 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
config
QueryOperationConfigConfiguration 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
filterExpression
ExpressionExpression 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
filter
ScanFilterFilter 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
config
ScanOperationConfigConfiguration 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
doc
Document
Returns
ToAttributeUpdateMap(Document, bool)
Creates a map of attribute names mapped to AttributeValueUpdate objects.
public Dictionary<string, AttributeValueUpdate> ToAttributeUpdateMap(Document doc, bool changedAttributesOnly)
Parameters
doc
DocumentchangedAttributesOnly
boolIf 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
doc
Document
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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
config
TableConfigConfiguration to use for the table.
table
TableLoaded 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
table
TableLoaded 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
conversion
DynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
table
TableLoaded 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
conversion
DynamoDBEntryConversionConversion to use for converting .NET values to DynamoDB values.
isEmptyStringValueEnabled
boolIf the property is false, empty string values will be interpreted as null values.
table
TableLoaded 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
ddbClient
IAmazonDynamoDBClient to use to access DynamoDB.
tableName
stringName of the table.
isEmptyStringValueEnabled
boolIf the property is false, empty string values will be interpreted as null values.
table
TableLoaded 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
doc
DocumentAttributes to update.
hashKey
PrimitiveHash key element of the document.
rangeKey
PrimitiveRange key element of the document.
config
UpdateItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
hashKey
PrimitiveHash key element of the document.
rangeKey
PrimitiveRange key element of the document.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
hashKey
PrimitiveHash key element of the document.
config
UpdateItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
hashKey
PrimitiveHash key element of the document.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
config
UpdateItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
key
IDictionary<string, DynamoDBEntry>Key of the document.
config
UpdateItemOperationConfigConfiguration to use.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
key
IDictionary<string, DynamoDBEntry>Key of the document.
cancellationToken
CancellationTokenToken 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
doc
DocumentAttributes to update.
cancellationToken
CancellationTokenToken which can be used to cancel the task.