Now, we will see how to use the object persistence model in .Net to create a custom object.
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.
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:
Declare the
product
class as we did earlier. We also need to create the customobject
class and declare this class in theproduct
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...