Now, we will see how to use the object persistence model in .Net to get the data from DynamoDB.
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.
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, "book");