Creating Entities in the Data Model: Step-by-Step Guide
Last updated
Last updated
Entities are the building blocks of your data model, representing the objects or concepts that you want to store and manipulate in your application. In this comprehensive guide, we will explore the step-by-step process of creating entities, setting their properties, establishing relationships, and ensuring data integrity.
In the ComUnity Developer Toolkit, you have the flexibility to create entities within your data model in two ways: starting from scratch ( custom entities) or utilising existing SQL tables. This provides you with the freedom to tailor your data model according to your specific requirements. In this section, we will explore both options, guiding you through the process of creating entities from scratch and mapping them from SQL tables.
To create a custom entity, follow these steps:
In your project settings in the Toolkit navigate to Data then select Diagram or List to view your Data Model.
Locate the icon on the Diagram or List (shown below) view. This icon allows you to add a new entity to your data model.
\
Click icon, and an Add a new entity modal window will appear on your screen.\
In the Entity Name box, provide a descriptive name for your entity. Choose a name that represents the object or concept it represents in your application. Note that a valid entity name is unique and cannot contain special characters or spaces.
Finally, click on the Add an entity button to create your custom entity.
Integrate your existing data seamlessly into your data model using the ComUnity Developer Toolkit. By automatically generating entity fields from your existing tables, you save time and effort. Simply migrate your database to the ComUnity platform with the assistance of the ComUnity Team, and during entity creation, these existing tables will be readily available in your Data model. Simplify the process and ensure data consistency by leveraging this automation feature.
To create an entity from existing SQL Tables, follow these steps:
Follow the steps outlined in Create a Custom Entity to access the Add a new entity modal window.
In the modal window, under Create from existing SQL Tables, you will find a greyed-out select field.
Click on Create from existing SQL Table to activate the select field.
Choose an option from the select field that corresponds to the existing SQL table you want to create an entity from.
In the Entity Name box, provide a descriptive name for your entity. Choose a name that represents the object or concept it represents in your application. Note that a valid entity name is unique and cannot contain special characters or spaces.
Finally, click Add an Entity to create the entity based on the selected SQL table.
By following these steps, you can effortlessly incorporate your existing SQL tables into your data model, leveraging the power of the ComUnity Developer Toolkit.
To view the entity properties in a Diagram view, simply click on the entity's header section with a grey background colour. An active entity can be identified by its blue border, and none of its entity fields will be active (active entity fields have a blue background colour). This action will open a properties dialog that displays the global properties specific to the entity.
Conversely, if you are in a List view, clicking on an entity will activate it, and an active entity will have a distinctive blue background colour. Clicking on the entity in this view will also open the properties dialog, allowing you to explore and modify the entity's global settings.
For a detailed description and explanation of each entity property, please refer to the table below.
Property Name | Description |
---|---|
Inherits from Entity | |
Entity Set Name | The name of the EntitySet in OData URLs. By default the Entity Set and SQL table name are the same. |
Edit Table Security | |
Custom Property Definitions | Unsupported in V4 |
Table Name | SQL table name |
Temporal (History) Table | Choose whether to add or remove support for storing change history |
Reset Custom Code | Check to replace custom code with default template |
Custom Code | Logic that executes when intercepting change operations |
List Title Template | Default template used for rendering titles of lists containing items of the entity set |
List Detail Template | Default template used for rendering detail line of lists containing items of the entity set. |
Sort Order | Default sort order when fetching entity set |
Data Service Url | Override the default OData URL for the EntitySet endpoint with a custom Web API URL handling reading, inserting, updating and deleting records. |
Max Age | The valid life time for data used in automatically refreshing lists. |