Book Image

DynamoDB Cookbook

By : Tanmay Deshpande
Book Image

DynamoDB Cookbook

By: Tanmay Deshpande

Overview of this book

Table of Contents (18 chapters)
DynamoDB Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a custom object for the DynamoDB table using the object persistence model in .Net


Now, we will see how to use the object persistence model in .Net to create a custom object.

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…

The object persistence model for .Net only supports primitive data types to be used as attribute data types. But, sometimes, we might want to use some custom objects. In order to do so, we need to perform the following operations:

  1. Declare the product class as we did earlier. We also need to create the custom object class and declare this class in the product class. In this case, we want to create an object that will help us store the dimensions of the product, and then it can be declared, as follows:

    public class Dimension
        {
            public decimal Length { get; set; }
            public decimal Height { get; set; }
            public decimal...