page header

Entity Editor, Fields Tab

The Fields tab of the Entity Editor contains the information and editors for working with the fields of the entity, the unique constraints defined over these fields and the Fields mapped onto Related Fields. The different parts are contained in three horizontal sub-tabs which are described below.

Entity Fields sub-tab

This sub-tab shows the fields defined in the entity. The fields are shown in a grid, and directly editable. To add a new field, click in the top-row of the grid or (when the grid already has focus) press cntrl-shift-F to add a new field to the entity. You don't have to specify all the columns, only the first two, Name and Type are mandatory. When you've specified enough information for the field, press cntrl-enter to add the field. A new field will automatically get a target field mapped, if the designer can find an unmapped field in the mapped target element (if the entity is mapped to a target (table/view) already) matching the newly added field.

Editing fields uses type shortcuts for specifying types easily. You can type the first characters of the type shortcut to make the grid automatically pre-select the type(s) matching the characters typed, like intellisense. Pressing TAB will move the focus to the next column. To edit the Description, move to that column using TAB or cursor keys and press cntrl-DownArrow to open the small text editor to specify a description for a field. Descriptions are generated as XML DOC comments into the output.

To remove one or more fields, you have to select the fields using the row headers in the grid and click the button at the bottom of the subtab called 'Remove selected'.

To set the field order for the fields, click the Set Field Ordering button, which will bring up the Field Order Selector to specify the field ordering for the entity.

Refactoring fields

The designer also supports refactoring of entity definitions by offering a small set of refactoring options for one or more selected fields. To perform a particular refactoring, select one or more fields to which the refactoring will be applied and click the 'Refactor selected...' button at the bottom to select the refactoring from the list of available refactorings. Not all refactorings are available at all times, only the ones which make sense for a particular situation: inheritance oriented refactorings aren't available when the entity isn't in an inheritance hierarchy

The following refactoring options are available:

Unique Constraints sub-tab

This sub-tab allows you to define one or more unique constraints over the fields defined in the entity. In some target frameworks (e.g. LLBLGen Pro RTL) these unique constraints are used to create extra constructors / filter presets. They're also used to define unique constraints in the Relational Model Data, for the fields mapped by the entity fields in the unique constraints.

To define a unique constraint, click in the top row of the grid and specify a valid name for the unique constraint. The second column is an editor which opens in a separate dialog which allows you to select the field(s) of the unique constraint. Press cntrl-enter to add the row to the grid, which adds the unique constraint to the entity definition.

It's not necessary to define a unique constraint for foreign key fields participating in a 1:1 relationship: LLBLGen Pro creates these unique constraints in the Relational Model Data automatically for you. Any unique constraint defined over the same fields is therefore redundant.

To remove a unique constraint from the list of unique constraints of an entity, simply select it and click the 'Remove selected' button at the bottom.

Fields mapped onto related fields sub-tab

Fields mapped onto related fields is a feature which allows you to map a 'field' onto a related field (e.g. in the entity 'Order' the field 'CompanyName' in the related entity 'Customer' to a local field 'CompanyName') in a related entity. These fields are not real entity fields (they're not mapped onto an element in the target Table / View) and can't participate in database queries; they're a feature which is used in the code generator to produce properties in entity classes which refer to fields in a related entity. This is useful in databinding scenarios where an extra column is sometimes required in a list like control, like a grid, though that column is data from a related entity.

Fields of entities which are related over m:1 or 1:1 relationships are mappable as 'Fields mapped onto related fields'. For example, an Order entity has a related entity 'Customer'. To map the Customer.CompanyName field as a field in 'Order', simply add it as a Field mapped onto Related fields in the Entity Editor for Order. Click the top row in the grid to add a new row and select the field to map from the combo box. Press TAB to advance to the next column to see the field type and specify the name of the field. Eventually select the checkbox for 'ReadOnly' and after that press cntrl-enter to add the definition to the entity.

To remove a Field mapped onto a related field, select it using the row header in the grid and click the 'Remove selected' button at the bottom.


LLBLGen Pro Designer v4.1 documentation. ©2002-2013 Solutions Design