Interface IDynamoDBContext
- Namespace
- Amazon.DynamoDBv2.DataModel
- Assembly
- AWSSDK.DynamoDBv2.dll
Context interface for using the DataModel mode of DynamoDB. Used to interact with the service, save/load objects, etc.
public interface IDynamoDBContext : IDisposable- Inherited Members
Methods
CreateBatchGet<T>(DynamoDBOperationConfig)
Creates a strongly-typed BatchGet object, allowing a batch-get operation against DynamoDB.
BatchGet<T> CreateBatchGet<T>(DynamoDBOperationConfig operationConfig = null)Parameters
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override that table used. 
Returns
- BatchGet<T>
- Empty strongly-typed BatchGet object 
Type Parameters
- T
- Type of objects to get 
CreateBatchWrite<T>(DynamoDBOperationConfig)
Creates a strongly-typed BatchWrite object, allowing a batch-write operation against DynamoDB.
BatchWrite<T> CreateBatchWrite<T>(DynamoDBOperationConfig operationConfig = null)Parameters
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override that table used. 
Returns
- BatchWrite<T>
- Empty strongly-typed BatchWrite object 
Type Parameters
- T
- Type of objects to write 
CreateMultiTableBatchGet(params BatchGet[])
Creates a MultiTableBatchGet object, composed of multiple individual BatchGet objects.
MultiTableBatchGet CreateMultiTableBatchGet(params BatchGet[] batches)Parameters
- batchesBatchGet[]
- Individual BatchGet objects 
Returns
- MultiTableBatchGet
- Composite MultiTableBatchGet object 
CreateMultiTableBatchWrite(params BatchWrite[])
Creates a MultiTableBatchWrite object, composed of multiple individual BatchWrite objects.
MultiTableBatchWrite CreateMultiTableBatchWrite(params BatchWrite[] batches)Parameters
- batchesBatchWrite[]
- Individual BatchWrite objects 
Returns
- MultiTableBatchWrite
- Composite MultiTableBatchWrite object 
DeleteAsync<T>(object, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Delete operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete
Task DeleteAsync<T>(object hashKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the object to delete. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override that table used. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type of object. 
DeleteAsync<T>(object, object, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Delete operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete
Task DeleteAsync<T>(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the object to delete. 
- rangeKeyobject
- Range key element of the object to delete. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override that table used. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type of object. 
DeleteAsync<T>(object, object, CancellationToken)
Initiates the asynchronous execution of the Delete operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete
Task DeleteAsync<T>(object hashKey, object rangeKey, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the object to delete. 
- rangeKeyobject
- Range key element of the object to delete. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type of object. 
DeleteAsync<T>(object, CancellationToken)
Initiates the asynchronous execution of the Delete operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete
Task DeleteAsync<T>(object hashKey, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the object to delete. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type of object. 
DeleteAsync<T>(T, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Delete operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete
Task DeleteAsync<T>(T value, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- valueT
- Object to delete. 
- operationConfigDynamoDBOperationConfig
- Overriding configuration. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type of object. 
DeleteAsync<T>(T, CancellationToken)
Initiates the asynchronous execution of the Delete operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete
Task DeleteAsync<T>(T value, CancellationToken cancellationToken = default)Parameters
- valueT
- Object to delete. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type of object. 
ExecuteBatchGetAsync(BatchGet[], CancellationToken)
Issues a batch-get request with multiple batches.
Results are stored in the individual batches.
Task ExecuteBatchGetAsync(BatchGet[] batches, CancellationToken cancellationToken = default)Parameters
- batchesBatchGet[]
- Configured BatchGet objects 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
ExecuteBatchWriteAsync(BatchWrite[], CancellationToken)
Issues a batch-write request with multiple batches.
Task ExecuteBatchWriteAsync(BatchWrite[] batches, CancellationToken cancellationToken = default)Parameters
- batchesBatchWrite[]
- Configured BatchWrite objects 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
FromDocument<T>(Document)
Deserializes a document to an instance of type T.
T FromDocument<T>(Document document)Parameters
- documentDocument
- Document with properties to use. 
Returns
- T
- Object of type T, populated with properties from the document. 
Type Parameters
- T
- Type to populate. 
FromDocument<T>(Document, DynamoDBOperationConfig)
Deserializes a document to an instance of type T.
T FromDocument<T>(Document document, DynamoDBOperationConfig operationConfig)Parameters
- documentDocument
- Document with properties to use. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- T
- Object of type T, populated with properties from the document. 
Type Parameters
- T
- Type to populate. 
FromDocuments<T>(IEnumerable<Document>)
Deserializes a collections of documents to a collection of instances of type T.
IEnumerable<T> FromDocuments<T>(IEnumerable<Document> documents)Parameters
- documentsIEnumerable<Document>
- Documents to deserialize. 
Returns
- IEnumerable<T>
- Collection of items of type T, each populated with properties from a corresponding document. 
Type Parameters
- T
- Type to populate. 
FromDocuments<T>(IEnumerable<Document>, DynamoDBOperationConfig)
Deserializes a collections of documents to a collection of instances of type T.
IEnumerable<T> FromDocuments<T>(IEnumerable<Document> documents, DynamoDBOperationConfig operationConfig)Parameters
- documentsIEnumerable<Document>
- Documents to deserialize. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- IEnumerable<T>
- Collection of items of type T, each populated with properties from a corresponding document. 
Type Parameters
- T
- Type to populate. 
FromQueryAsync<T>(QueryOperationConfig, DynamoDBOperationConfig)
Configures an async Query operation against DynamoDB, finding items that match the specified conditions.
AsyncSearch<T> FromQueryAsync<T>(QueryOperationConfig queryConfig, DynamoDBOperationConfig operationConfig = null)Parameters
- queryConfigQueryOperationConfig
- Query request object. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- AsyncSearch<T>
- AsyncSearch which can be used to retrieve DynamoDB data. 
Type Parameters
- T
- Type of object. 
FromScanAsync<T>(ScanOperationConfig, DynamoDBOperationConfig)
Configures an async Scan operation against DynamoDB, finding items that match the specified conditions.
AsyncSearch<T> FromScanAsync<T>(ScanOperationConfig scanConfig, DynamoDBOperationConfig operationConfig = null)Parameters
- scanConfigScanOperationConfig
- Scan request object. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- AsyncSearch<T>
- AsyncSearch which can be used to retrieve DynamoDB data. 
Type Parameters
- T
- Type of object. 
GetTargetTable<T>(DynamoDBOperationConfig)
Retrieves the target table for the specified type
Table GetTargetTable<T>(DynamoDBOperationConfig operationConfig = null)Parameters
- operationConfigDynamoDBOperationConfig
Returns
- Table
- Table object 
Type Parameters
- T
- Type to retrieve table for 
LoadAsync<T>(object, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Load operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load
Task<T> LoadAsync<T>(object hashKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the target item. 
- operationConfigDynamoDBOperationConfig
- Overriding configuration. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task<T>
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to populate. 
LoadAsync<T>(object, object, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Load operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load
Task<T> LoadAsync<T>(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the target item. 
- rangeKeyobject
- Range key element of the target item. 
- operationConfigDynamoDBOperationConfig
- Overriding configuration. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task<T>
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to populate. 
LoadAsync<T>(object, object, CancellationToken)
Initiates the asynchronous execution of the Load operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load
Task<T> LoadAsync<T>(object hashKey, object rangeKey, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the target item. 
- rangeKeyobject
- Range key element of the target item. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task<T>
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to populate. 
LoadAsync<T>(object, CancellationToken)
Initiates the asynchronous execution of the Load operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load
Task<T> LoadAsync<T>(object hashKey, CancellationToken cancellationToken = default)Parameters
- hashKeyobject
- Hash key element of the target item. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task<T>
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to populate. 
LoadAsync<T>(T, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Load operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load
Task<T> LoadAsync<T>(T keyObject, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- keyObjectT
- Key of the target item. 
- operationConfigDynamoDBOperationConfig
- Overriding configuration. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task<T>
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to populate. 
LoadAsync<T>(T, CancellationToken)
Initiates the asynchronous execution of the Load operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load
Task<T> LoadAsync<T>(T keyObject, CancellationToken cancellationToken = default)Parameters
- keyObjectT
- Key of the target item. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task<T>
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to populate. 
QueryAsync<T>(object, DynamoDBOperationConfig)
Configures an async Query operation against DynamoDB, finding items that match the specified hash primary key.
AsyncSearch<T> QueryAsync<T>(object hashKeyValue, DynamoDBOperationConfig operationConfig = null)Parameters
- hashKeyValueobject
- Hash key of the items to query. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- AsyncSearch<T>
- AsyncSearch which can be used to retrieve DynamoDB data. 
Type Parameters
- T
- Type of object. 
QueryAsync<T>(object, QueryOperator, IEnumerable<object>, DynamoDBOperationConfig)
Configures an async Query operation against DynamoDB, finding items that match the specified range element condition for a hash-and-range primary key.
AsyncSearch<T> QueryAsync<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, DynamoDBOperationConfig operationConfig = null)Parameters
- hashKeyValueobject
- Hash key of the items to query. 
- opQueryOperator
- Operation of the condition. 
- valuesIEnumerable<object>
- Value(s) of the condition. For all operations except QueryOperator.Between, values should be one value. For QueryOperator.Betwee, values should be two values. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- AsyncSearch<T>
- AsyncSearch which can be used to retrieve DynamoDB data. 
Type Parameters
- T
- Type of object. 
SaveAsync<T>(T, DynamoDBOperationConfig, CancellationToken)
Initiates the asynchronous execution of the Save operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Save
Task SaveAsync<T>(T value, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default)Parameters
- valueT
- Object to save. 
- operationConfigDynamoDBOperationConfig
- Overriding configuration. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to save as. 
SaveAsync<T>(T, CancellationToken)
Initiates the asynchronous execution of the Save operation. Amazon.DynamoDBv2.DataModel.DynamoDBContext.Save
Task SaveAsync<T>(T value, CancellationToken cancellationToken = default)Parameters
- valueT
- Object to save. 
- cancellationTokenCancellationToken
- Token which can be used to cancel the task. 
Returns
- Task
- A Task that can be used to poll or wait for results, or both. 
Type Parameters
- T
- Type to save as. 
ScanAsync<T>(IEnumerable<ScanCondition>, DynamoDBOperationConfig)
Configures an async Scan operation against DynamoDB, finding items that match the specified conditions.
AsyncSearch<T> ScanAsync<T>(IEnumerable<ScanCondition> conditions, DynamoDBOperationConfig operationConfig = null)Parameters
- conditionsIEnumerable<ScanCondition>
- Conditions that the results should meet. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override that table used. 
Returns
- AsyncSearch<T>
- AsyncSearch which can be used to retrieve DynamoDB data. 
Type Parameters
- T
- Type of object. 
ToDocument<T>(T)
Serializes an object to a Document.
Document ToDocument<T>(T value)Parameters
- valueT
- Object to serialize. 
Returns
- Document
- Document with attributes populated from object. 
Type Parameters
- T
- Type to serialize as. 
ToDocument<T>(T, DynamoDBOperationConfig)
Serializes an object to a Document.
Document ToDocument<T>(T value, DynamoDBOperationConfig operationConfig)Parameters
- valueT
- Object to serialize. 
- operationConfigDynamoDBOperationConfig
- Config object which can be used to override the table used. 
Returns
- Document
- Document with attributes populated from object. 
Type Parameters
- T
- Type to serialize as.