Retrieving items from the DynamoDB table using the object persistence model in .Net
Now, we will see how to use the object persistence model in .Net to get the data from DynamoDB.
Getting ready
To perform this recipe, you should have set up the project, as described in the earlier recipes, specifically, pom.xml
, dependencies, and the object model.
How to do it…
- Create an instance of
AmazonDynamoDBClient
and instantiate theDynamoDBContext
class, which will be the entry point to DynamoDB:AmazonDynamoDBClient client = new AmazonDynamoDBClient(); DynamoDBContext context = new DynamoDBContext(client);
- Invoke the load method from the
DynamoDBContext
class, specifying the keys of a DynamoDB item that you wish to retrieve:Product productRetrieved = context.Load<Product>(111, ...
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.