Batch write operations using the AWS SDK for .Net

Let's understand how to put or delete multiple items from the DynamoDB table using the AWS SDK for .Net.

Getting ready

To perform this operation, you can use the IDE of your choice.

How to do it…

Let's try to understand how to put/delete items from the DynamoDB table using .Net.

  1. Create an instance of the AmazonDynamoDBClient class:
    AmazonDynamoDBClient client = new AmazonDynamoDBClient();
    string tableName = "productTable";
  2. Create the BatchWriteItem request instance and specify the items that you wish to put or delete:
    var request = new BatchWriteItemRequest { RequestItems = new Dictionary<string, List<WriteRequest>> { { tableName, new List<WriteRequest> { new WriteRequest { PutRequest = new PutRequest ...

Get DynamoDB Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.