Skip to main content
To create a new instance of an Entity, we use the 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

  1. Create an Entity by calling the CreateNew method.
  2. Assign a value to at least one of its properties.
  3. 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 a Sale Entity and populate it with some very basic and simple properties.
By simple and basic we mean that the properties are either system-provided simple data types like 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.

See also