Scanning items from the DynamoDB table using the object persistence model in .Net

Now, we are going to see how to scan items from the table using the object persistence model in .Net.

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…

  1. Create an instance of AmazonDynamoDBClient and instantiate the DynamoDBContext class, which will be the entry point to DynamoDB:
    AmazonDynamoDBClient client = new AmazonDynamoDBClient();
    DynamoDBContext context = new DynamoDBContext(client);
  2. Now, let's write a scan condition to fetch all the items whose type is book:
    context.Scan<Product>( new ScanCondition("type", ScanOperator.EqualTo, "book")); ...

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.