Support of DynamoDB for .NET
CAST supports DynamoDB via its com.castsoftware.nosqldotnet extension. Details about how this support is provided for .NET source code is discussed below.
Supported Client Libraries
Library | Version | Supported |
---|---|---|
AWS DynamoDB .NET SDK | up to: 2.x |
Supported Operations
Operation | Methods Supported |
---|---|
Insert | Amazon.DynamoDBv2.AmazonDynamoDBClient.CreateBackup Amazon.DynamoDBv2.AmazonDynamoDBClient.CreateBackupAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.CreateGlobalTable Amazon.DynamoDBv2.AmazonDynamoDBClient.CreateGlobalTableAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.CreateTable Amazon.DynamoDBv2.AmazonDynamoDBClient.CreateTableAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.ImportTable Amazon.DynamoDBv2.AmazonDynamoDBClient.ImportTableAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.PutItem Amazon.DynamoDBv2.AmazonDynamoDBClient.PutResourcePolicy Amazon.DynamoDBv2.AmazonDynamoDBClient.PutResourcePolicyAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.RestoreTableFromBackup Amazon.DynamoDBv2.AmazonDynamoDBClient.RestoreTableFromBackupAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.ExecuteStatement Amazon.DynamoDBv2.AmazonDynamoDBClient.ExecuteStatementAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.ExecuteTransaction Amazon.DynamoDBv2.DocumentModel.Table.PutItem Amazon.DynamoDBv2.DocumentModel.Table.PutItemAsync Amazon.DynamoDBv2.DocumentModel.Table.TryPutItem Amazon.DynamoDBv2.DataModel.DynamoDBContext.Save Amazon.DynamoDBv2.DataModel.DynamoDBContext.SaveAsync Amazon.DynamoDBv2.IAmazonDynamoDB.CreateTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.CreateBackupAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ImportTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.RestoreTableFromBackupAsync Amazon.DynamoDBv2.IAmazonDynamoDB.BatchWriteItemAsync Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateGlobalTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateGlobalTableSettingsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteBackupAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteResourcePolicyAsync Amazon.DynamoDBv2.DocumentModel.Table.TryPutItem Amazon.DynamoDBv2.DocumentModel.Table.CreateBatchWrite Amazon.DynamoDBv2.DocumentModel.Table.CreateTransactWrite |
Update | Amazon.DynamoDBv2.AmazonDynamoDBClient.UpdateItem Amazon.DynamoDBv2.AmazonDynamoDBClient.UpdateItemAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.UpdateTable Amazon.DynamoDBv2.AmazonDynamoDBClient.UpdateTableAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchExecuteStatement Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchExecuteStatementAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.GetItem Amazon.DynamoDBv2.AmazonDynamoDBClient.GetItemAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.Scan Amazon.DynamoDBv2.AmazonDynamoDBClient.ScanAsync Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateItem Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateItemAsync Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateTable Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.TransactGetItemsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.TransactWriteItemsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ExecuteStatementAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ExecuteTransactionAsync Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem Amazon.DynamoDBv2.DocumentModel.Table.UpdateItemAsync Amazon.DynamoDBv2.DocumentModel.Table.TryUpdateItem Amazon.DynamoDBv2.DocumentModel.Table.UpdateHelper |
Select | Amazon.DynamoDBv2.AmazonDynamoDBClient.Scan Amazon.DynamoDBv2.AmazonDynamoDBClient.ScanAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchGetItem Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchGetItemAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchWriteItem Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchWriteItemAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.GetItem Amazon.DynamoDBv2.AmazonDynamoDBClient.GetItemAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchExecuteStatement Amazon.DynamoDBv2.AmazonDynamoDBClient.BatchExecuteStatementAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeTable Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.BatchGetItem Amazon.DynamoDBv2.IAmazonDynamoDB.BatchGetItemAsync Amazon.DynamoDBv2.IAmazonDynamoDB.Query Amazon.DynamoDBv2.IAmazonDynamoDB.QueryAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeBackupAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeContinuousBackupsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeEndpointsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeExportAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeGlobalTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeGlobalTableSettingsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeImportAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DescribeTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ImportTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ListBackupsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ListImportsAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ListTablesAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ScanAsync Amazon.DynamoDBv2.DataModel.DynamoDBContext.QueryAsync Amazon.DynamoDBv2.DataModel.DynamoDBContext.LoadAsync Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load Amazon.DynamoDBv2.DataModel.DynamoDBContext.Scan Amazon.DynamoDBv2.DataModel.DynamoDBContext.ScanAsync Amazon.DynamoDBv2.DataModel.DynamoDBContext.FromDocuments Amazon.DynamoDBv2.DataModel.DynamoDBContext.FromQuery Amazon.DynamoDBv2.DocumentModel.Table.DescribeTable Amazon.DynamoDBv2.DocumentModel.Table.GetItem Amazon.DynamoDBv2.DocumentModel.Table.GetItemAsync Amazon.DynamoDBv2.DocumentModel.Table.Query Amazon.DynamoDBv2.DocumentModel.Table.Scan Amazon.DynamoDBv2.DocumentModel.Table.TryLoadTable Amazon.DynamoDBv2.DocumentModel.Table.TryLoadTable Amazon.DynamoDBv2.DocumentModel.Table.CreateBatchGet Amazon.DynamoDBv2.DocumentModel.Table.CreateTransactGet Amazon.DynamoDBv2.DocumentModel.Table.GetItemHelper Amazon.DynamoDBv2.DocumentModel.Table.GetItemHelperAsync Amazon.DynamoDBv2.DocumentModel.Table.LoadTableInfo |
Delete | Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteItem Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteItemAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteTable Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteTableAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteBackup Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteBackupAsync Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteResourcePolicy Amazon.DynamoDBv2.AmazonDynamoDBClient.DeleteResourcePolicyAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteItem Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteItemAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteTable Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteTableAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ExecuteStatementAsync Amazon.DynamoDBv2.IAmazonDynamoDB.ExecuteTransactionAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteBackupAsync Amazon.DynamoDBv2.IAmazonDynamoDB.DeleteResourcePolicyAsync Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete Amazon.DynamoDBv2.DataModel.DynamoDBContext.DeleteAsync Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem Amazon.DynamoDBv2.DocumentModel.Table.DeleteItemAsync Amazon.DynamoDBv2.DocumentModel.Table.TryDeleteItem Amazon.DynamoDBv2.DocumentModel.Table.TryDeleteItem Amazon.DynamoDBv2.DocumentModel.Table.DeleteHelper Amazon.DynamoDBv2.DocumentModel.Table.DeleteHelperAsync |
Objects
Icon | Description |
---|---|
DotNet AWS DynamoDB Client | |
DotNet AWS DynamoDB Table | |
DotNet AWS Unknown DynamoDB Client | |
|
DotNet AWS Unknown DynamoDB Table |
Links
Link type | Source and destination of link | Methods Supported |
---|---|---|
belongsTo |
From DotNet AWS DynamoDB Table to DotNet AWS DynamoDB Client object |
- |
useInsertink |
Between the caller .NET Method (C#) object and DotNet AWS DynamoDB Table |
|
useUpdateLink | Between the caller .NET Method (C#) object and DotNet AWS DynamoDB Table |
|
useSelectLink | Between the caller .NET Method (C#) object and DotNet AWS DynamoDB Table |
|
useDeleteLink | Between the caller .NET Method (C#) object and DotNet AWS DynamoDB Table |
|
What results can you expect?
Some example scenarios are shown below:
AmazonDynamoDB Client and Table Creation
class MidlevelItemCRUD
{
AmazonDynamoDBConfig clientConfig = new AmazonDynamoDBConfig();
// Set the endpoint URL
clientConfig.ServiceURL = "http://localhost:8000";
AmazonDynamoDBClient client = new AmazonDynamoDBClient(clientConfig);
private static string tableName = "ProductCatalog";
// The sample uses the following id PK value to add book item.
private static int sampleBookId = 555;
static void Main(string[] args)
{
try
{
Table productCatalog = Table.LoadTable(client, tableName);
CreateBookItem(productCatalog);
RetrieveBook(productCatalog);
// Couple of sample updates.
UpdateMultipleAttributes(productCatalog);
UpdateBookPriceConditionally(productCatalog);
// Delete.
DeleteBook(productCatalog);
Console.WriteLine("To continue, press Enter");
Console.ReadLine();
}
catch (AmazonDynamoDBException e) { Console.WriteLine(e.Message); }
catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
catch (Exception e) { Console.WriteLine(e.Message); }
}
Insert Operation
private static void CreateBookItem(Table productCatalog)
{
Console.WriteLine("\n* Executing CreateBookItem() *");
var book = new Document();
book["Id"] = sampleBookId;
book["Title"] = "Book " + sampleBookId;
book["Price"] = 19.99;
book["ISBN"] = "111-1111111111";
book["Authors"] = new List<string> { "Author 1", "Author 2", "Author 3" };
book["PageCount"] = 500;
book["Dimensions"] = "8.5x11x.5";
book["InPublication"] = new DynamoDBBool(true);
book["InStock"] = new DynamoDBBool(false);
book["QuantityOnHand"] = 0;
productCatalog.PutItem(book);
}
Select Operation
private static void RetrieveBook(Table productCatalog)
{
Console.WriteLine("\n* Executing RetrieveBook() *");
// Optional configuration.
GetItemOperationConfig config = new GetItemOperationConfig
{
AttributesToGet = new List<string> { "Id", "ISBN", "Title", "Authors", "Price" },
ConsistentRead = true
};
Document document = productCatalog.GetItem(sampleBookId, config);
Console.WriteLine("RetrieveBook: Printing book retrieved...");
PrintDocument(document);
}
Update Operation
private static void UpdateBookPriceConditionally(Table productCatalog)
{
Console.WriteLine("\n* Executing UpdateBookPriceConditionally() *");
int partitionKey = sampleBookId;
var book = new Document();
book["Id"] = partitionKey;
book["Price"] = 29.99;
// For conditional price update, creating a condition expression.
Expression expr = new Expression();
expr.ExpressionStatement = "Price = :val";
expr.ExpressionAttributeValues[":val"] = 19.00;
// Optional parameters.
UpdateItemOperationConfig config = new UpdateItemOperationConfig
{
ConditionalExpression = expr,
ReturnValues = ReturnValues.AllNewAttributes
};
Document updatedBook = productCatalog.UpdateItem(book, config);
Console.WriteLine("UpdateBookPriceConditionally: Printing item whose price was conditionally updated");
PrintDocument(updatedBook);
}
Delete Operation
private static void DeleteBook(Table productCatalog)
{
Console.WriteLine("\n* Executing DeleteBook() *");
// Optional configuration.
DeleteItemOperationConfig config = new DeleteItemOperationConfig
{
// Return the deleted item.
ReturnValues = ReturnValues.AllOldAttributes
};
Document document = productCatalog.DeleteItem(sampleBookId, config);
Console.WriteLine("DeleteBook: Printing deleted just deleted...");
PrintDocument(document);
}
Known Limitations
- Client objects are always default with the name ‘client’
- If the client and table are not resolved will create Unknown Objects.