Saving items into the DynamoDB table using the object persistence model in .Net
In the earlier recipes, we discussed how to use the object persistence model using Java; now, we will see how to use 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…
Let's see how to use the object persistence model in .Net:
Here, we will first create the
data
model and map the attributes to the attributes in a DynamoDB table. The .Net SDK provides built-in support for the object persistence model, so you don't need to do anything else. Annotations can be used to perform the mapping of data, as shown in the following code:[DynamoDBTable("product")] public class Product { [DynamoDBHashKey] // Hash key. public int id { get; set; } [DynamoDBRangeKey] // Range key. public string type { get; set; } ...