The method of viewing entities fields depends on whether they are represented in an entity diagram or as a list:
Diagram: For entities presented in an entity diagram, the entity fields are visually represented within the diagram itself. Each entity will have its attributes displayed directly in the diagram, providing a comprehensive overview of its structure and relationships.
List: If the entities are presented as a list, you can expand and view their attributes by clicking the (+) icon that precedes the entity name. This will expand the entity and display its attributes in a detailed view. Conversely, to hide the properties, you can click the (-) icon.
By using these intuitive interface elements, you can easily explore and examine the properties of your entities, whether they are presented in an entity diagram or as a list.
When you create a new entity in the ComUnity Developer Toolkit, it automatically inherits from a BaseEntity, which provides several default fields (attributes) for enhanced functionality. These attributes include:
Created
: Represents the timestamp when the entity was initially created. This property is set to the exact date and time when the entity was added to the system and is immutable.
Modified
: Indicates the timestamp when the entity was last modified. This property is updated every time the entity undergoes any changes, reflecting the most recent date and time of modification. Like the Created
property, the Modified
property is also immutable.
Deleted
: Marks the entity as deleted, typically by setting a flag or status to indicate its removal from the system. Similar to the previous properties, the Deleted
property is immutable.
<EntityName>Id:
An integer (int) type property that serves as the unique identifier for all records created from the entity.
By incorporating these default fields, the ComUnity Developer Toolkit ensures efficient tracking of entity creation, modification, and deletion, while providing a means to uniquely identify and manage records within the entity.
To add a fields to an entity, follow these steps:
Select the relevant Entity in the Diagram or List.
Click on any existing editable field within the Entity.
Right-click to open a context menu (shown below).
In the context menu, choose Add a field above or Add a field below to specify the position of the new field. This action will display the Add a new field modal window (shown below).
In the Name box, provide a descriptive name for your field. Note that a valid field name is unique and cannot contain special characters or spaces.
Finally, click Add field to create the new field.
Once you have completed these steps, you can proceed to customise the various properties of the entity field, such as its data type, roles, entity key (primary key), indexing, title, and UI control types. These properties will be discussed in detail in the following section.
In this section, we will explore the field properties and customisations available within the ComUnity Developer Toolkit. Once you have created an entity and its fields, you can further refine and configure each field according to your application's requirements. Discover how to define the data type, set roles, establish entity keys, enable indexing, provide titles, and choose UI control types for your fields. Gain a comprehensive understanding of how to customise and fine-tune your entity fields to optimise data storage, retrieval, and presentation.
To view the properties of a field, simply click on the desired property to select it. This action will open a Properties dialog on the left-hand side of your interface, displaying the supported properties for the selected field. If you need to access additional settings, click on View more settings to expand the options. Conversely, if you prefer a simplified view, click on Hide settings to minimise the displayed properties. For a comprehensive understanding of each supported property, refer to the table below, which provides detailed descriptions.
Property name | Function | Value selection |
---|---|---|
Property Type | Select the type of data to be stored in this field. See Datatypes. | Select one from the list of 14 options. |
Entity Key | Sets the primary key. | Select the checkbox if the field is the primary key. |
Maximum Length | Defines the maximum number of characters this field can accommodate. | Enter the maximum number. |
Column Name | Defines the name for this field. | Enter a name for this field as it will appear in the database. |
Column Order | To use composite keys the Entity Framework (EF) requires you to define an order for the key properties. You can do this by using the Column annotation to specify an order. If you have entities with composite foreign keys, then you must specify the same column ordering that you used for the corresponding primary key properties. For more information: Go to Entity framework annotations URL https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/data-annotations | The order value is relative (rather than index-based) so any values can be used. For example, 100 and 200 would be acceptable in place of 1 and 2. |
Database Generated | An important database features is the ability to have computed properties. If you're mapping your Code First classes to tables that contain computed columns, you don't want Entity Framework to try to update those columns. But you do want the EF to return those values from the database after you've inserted or updated data. For more information: Go to Entity framework DatabaseGenerated URL https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/data-annotations#databasegenerated | Select one of: Computed, Identity, None. |
Minimum Length | Enter a minimum number of characters this field can accommodate | Enter the minimum number. |
Indexed | You can create an index on one or more columns using the IndexAttribute. Adding the attribute to one or more properties will cause EF to create the corresponding index in the database when it creates the database.. | Select the checkbox to activate the creation of an Index. |
Field Type | Select the behaviour type for this field. See Field Types. | Select the required field type from the dropdown list. |
Title | You can enter a Title name to define a custom label for the field when it is added to a form in the UI. | |
Default Value | Enter a default value for this field when a new record is created. |