Now, we are going to see how to scan items from the table using the object persistence model in .Net.
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);
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"));
Now, we can iterate over the products' list to go through the results.