Entity Types
What Are Entities?
Data classes which are stored in the Magentrix database are referred to as Entities. When thinking about Entities, think of Database Tables with business logic and built-in security added. Entities are recognized by their name, and at minimum they have an ID property that allows the records of that Entity to be uniquely identified. Most Entities have additional properties and fields. Some of these are added by the system, such as Audit fields (CreatedBy, ModifiedBy, CreatedOn, ModifiedOn) and others depend on the type of Entity (Name, Firstname/Lastname). Administrators and developers can also add custom fields. Magentrix allows organizations to build native Entities as well as Entities that are imported from other applications such as Salesforce.com CRM.
Entity Types
Magentrix native Entities support two Entity types:
- Person
- Object
Person Entity
Person entities have built-in properties of a person, such as First Name, Last Name, etc. The Name field is a calculated field that combines the First Name and Last Name values. This entity type is suitable for tracking and managing information such as Contacts, Leads, Students, etc.
Object Entity
Object Entities have a Name field, which can be an auto-number or text field. This entity type is suitable for tracking data for things such as Opportunities, Quotes, Orders, Invoices, etc.
All entities in Magentrix are a subclass of the "dbObject" class. The dbObject class has the following properties and methods:
Properties
| Name | Type | Description |
|---|
| Id | string | Record ID is stored in a database. |
| IsModelValid | bool | Determines that there is no validation errors on the Model (class). The property is read only and is set to true when you call the "AddError" method. |
Methods
| Name | Return Type | Description |
|---|
| AddError(string message) | void | Adds an error to the model state. |
| AddError(string fieldName, string message) | void | Adds an error to the model state which is associated with a specific property/field. |
| AddError(Exception ex) | void | Adds an error to the model state. |
| AddError(string fieldName, Exception ex) | void | Adds an error to the model state which is associated with a specific property/field. |
| Get(string fieldName) | object | Gets a field value. |
| Set(string fieldName, object value) | void | Sets a field value. |
The dbObject class also provides access to the following "static" methods:
| Name | Return Type | Description |
|---|
| dbObject.GetEntityType(string entityName) | Type | Returns the class type of the given entity. |
| dbObject.GetInstance(string entityName) | object | Returns a new instance of the entity model. |