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
operationConfig
DynamoDBOperationConfigConfig 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
operationConfig
DynamoDBOperationConfigConfig 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
batches
BatchGet[]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
batches
BatchWrite[]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
hashKey
objectHash key element of the object to delete.
operationConfig
DynamoDBOperationConfigConfig object which can be used to override that table used.
cancellationToken
CancellationTokenToken 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
hashKey
objectHash key element of the object to delete.
rangeKey
objectRange key element of the object to delete.
operationConfig
DynamoDBOperationConfigConfig object which can be used to override that table used.
cancellationToken
CancellationTokenToken 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
hashKey
objectHash key element of the object to delete.
rangeKey
objectRange key element of the object to delete.
cancellationToken
CancellationTokenToken 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
hashKey
objectHash key element of the object to delete.
cancellationToken
CancellationTokenToken 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
value
TObject to delete.
operationConfig
DynamoDBOperationConfigOverriding configuration.
cancellationToken
CancellationTokenToken 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
value
TObject to delete.
cancellationToken
CancellationTokenToken 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
batches
BatchGet[]Configured BatchGet objects
cancellationToken
CancellationTokenToken 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
batches
BatchWrite[]Configured BatchWrite objects
cancellationToken
CancellationTokenToken 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
document
DocumentDocument 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
document
DocumentDocument with properties to use.
operationConfig
DynamoDBOperationConfigConfig 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
documents
IEnumerable<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
documents
IEnumerable<Document>Documents to deserialize.
operationConfig
DynamoDBOperationConfigConfig 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
queryConfig
QueryOperationConfigQuery request object.
operationConfig
DynamoDBOperationConfigConfig 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
scanConfig
ScanOperationConfigScan request object.
operationConfig
DynamoDBOperationConfigConfig 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
operationConfig
DynamoDBOperationConfig
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
hashKey
objectHash key element of the target item.
operationConfig
DynamoDBOperationConfigOverriding configuration.
cancellationToken
CancellationTokenToken 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
hashKey
objectHash key element of the target item.
rangeKey
objectRange key element of the target item.
operationConfig
DynamoDBOperationConfigOverriding configuration.
cancellationToken
CancellationTokenToken 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
hashKey
objectHash key element of the target item.
rangeKey
objectRange key element of the target item.
cancellationToken
CancellationTokenToken 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
hashKey
objectHash key element of the target item.
cancellationToken
CancellationTokenToken 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
keyObject
TKey of the target item.
operationConfig
DynamoDBOperationConfigOverriding configuration.
cancellationToken
CancellationTokenToken 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
keyObject
TKey of the target item.
cancellationToken
CancellationTokenToken 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
hashKeyValue
objectHash key of the items to query.
operationConfig
DynamoDBOperationConfigConfig 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
hashKeyValue
objectHash key of the items to query.
op
QueryOperatorOperation of the condition.
values
IEnumerable<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.
operationConfig
DynamoDBOperationConfigConfig 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
value
TObject to save.
operationConfig
DynamoDBOperationConfigOverriding configuration.
cancellationToken
CancellationTokenToken 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
value
TObject to save.
cancellationToken
CancellationTokenToken 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
conditions
IEnumerable<ScanCondition>Conditions that the results should meet.
operationConfig
DynamoDBOperationConfigConfig 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
value
TObject 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
value
TObject to serialize.
operationConfig
DynamoDBOperationConfigConfig 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.