Data Model Editing

You can find Data Model editing interface in the Data/Manage data model section in the admin panel.

Tutorial

Watch this video to learn how to work with Data Models.

Data Model editing interface

This is Data Model editing interface:

Data Model editing interface

Its control elements have the following functions:

  1. Reference to all Data Models in the system.
  2. Name of the opened Data Model.
  3. Save button.
  4. Cancel changes button.
  5. Name - Data Model name.
  6. DB Object - table or view name in database.
  7. Scheme name - database (table belongs to) scheme name. It's a non-required field. If it's left empty, default scheme will be used (depends on current DBMS).
  8. Primary key - attribute name which is primary key. DWKit allows you to work with models without primary keys, but data and form mapping options will be limited in this case.
  9. Extensions container - attribute name in which other attributes marked as Extension are located. Learn more about Extension attributes here.
  10. Allows you to switch view mode for extension attributes only.
  11. Adding a new attribute into Data Model button.
  12. Name - attribute name. If it's not an extension attribute, this name must strictly match column name in database. If it's an extension attribute, it can be any name.
  13. Nullable - if checked, attribute value can be NULL.
  14. Calculated - if checked, attribute value will be calculated in the database (it can be identity columns or calculated columns). DWKit does not allow to update and insert such attributes, but it selects them from database.
  15. Extension- if checked, attribute will not be stored in a separate column. It will be stored in a JSON object, which in turn is stored in the column which name is set in Extensions container. Learn more about Extension attributes here.
  16. Type = Column - it's a regular attribute column with data. Data type is set by Data type property in column.
  17. Data type - data type in attribute column. Note, that it's .NET data type, and not DBMS data type.
  18. Type = Reference - this is an attribute reference to another Data model. You can select Data Model to which edited data model refers to on the Referenced entity property. This attribute data type will be the same as data type of the primary key of the model selected in the Referenced entity property. In other words it's a foreign key.
  19. Referenced entity - data model to which edited data model refers to.
  20. Button to delete attribute from model.

Data model and database mapping

  • Each data model is mapped to only one table or view. This table or view name is set in the DB Object property.
  • Multiple keys are not supported, that is why you can specify only one attribute value in the Primary key property.
  • If attribute is not marked as Extension (i.e. it is not an extension attribute), it is equivalent to a column in the database, that is why its Name must match column name.
  • If you've got an attribute reference (i.e. Type = Reference), it is not necessary to create a relevant foreign key in the database.
  • To create identity primary key mark relevant attribute of the primary key as Calculated.
  • If you've got an attribute reference (i.e. Type = Reference), DWKit must build requests with join to receive column values from the Data Model edited Data Model refers to. The following simple rule applies by default:
    • If attribute reference is nullable, OUTER JOIN is used.
    • If attribute reference is not nullable, INNER JOIN is used.