CreateNew method (of the Entity class that you are going to create). It must be saved using the Save method for the data to be stored in the database.
When calling
CreateNew(), a new instance of the Entity is created with default values assigned to its properties. However, it will not be saved if you call Save() without changing its properties first. Therefore, to save an Entity, you need to assign some new values to its properties.Syntax
- Create an Entity by calling the
CreateNewmethod. - Assign a value to at least one of its properties.
- Save it by calling Save().
Create an Entity with basic properties
After you have created the Entity, you want to populate the various properties exposed by it. The types of properties in a given Entity can be different from one another. Thus populating them with data will also change depending on the property type. In the following example, we create aSale Entity and populate it with some very basic and simple properties.
System.String or System.Double or NetServer-defined enumerations.
In a typical NetServer Entity, there are many more properties that are of very complex data types.