Skip to main content

Entity Model Designer

  • 3 minutes to read

The ExpressEntityMapping Framework ships with the Entity Model Designer – a standalone application that helps you visually design and customize entity models and generate classes based on them. The application provides context menus, built-in dialogs, and dockable windows for in-depth customization of entities, their properties, relationships, inheritance, and various mapping options.

With the Entity Model Designer, you can:

  • Select File | New in the main menu to create an empty entity model;

  • Select Model | Create Model from Database in the main menu to use an existing database to create an entity model. Use the Connection Editor dialog to specify connection settings for this database. To invoke this dialog, select Model | Edit Connection to Database… in the main menu or select Edit Connection… in the Database Browser window’s context menu;

  • Use the Entity Editor dialog or context menus provided by the Model Browser and Diagram windows to manage entities (via the Add Entity… and Delete menu commands and clipboard operations);

  • Select an entity in the Model Browser or Diagram window and invoke the Property Editor dialog or the window’s context menus to manage the entity’s properties (via the Add Property… and Delete menu commands and clipboard operations);

  • Use the Entity Editor or Property Editor dialog to specify how entities and their properties map to data store objects (tables, column names and data types, keys, indexes, etc.) To invoke the corresponding dialog, double-click an entity or its property in the Model Browser or Diagram window. Alternatively, you can select an entity or its property in one of these windows, invoke the context menu, and select Edit…;

  • Use the Inheritance Editor dialog to add or customize entity inheritance. To add an entity inheritance, select Add Inheritance… in the context menus provided by the Model Browser and Diagram windows. To customize an entity inheritance, either double-click it or select it in one of these windows, invoke the context menu, and select Edit…;

  • Use the Association Editor dialog to add or customize entity associations (relationships). To invoke this dialog, select Add Association… in the context menus provided by the Model Browser and Diagram windows. Alternatively, you can double-click an association or invoke its context menu and select Edit…;

  • Drag and drop diagram objects, collapse/expand, horizontally size, or remove them from the diagram. To re-create it and switch to the default layout, select Model | Create Diagram from Model in the main menu;

  • Hold down the Ctrl key and scroll the mouse wheel to zoom in/out of the diagram;

  • Save your entity model, its diagram, and database connection settings to a DMF file and load it later from the File menu;

  • Generate unit files (PAS files) containing entity class declarations and interfaces that enable support for LINQ expressions based on your entity model (Model | Generate Code Files). These files include the essential information about the entity model, complete with entity class registration code, built-in attributes, and initialization code for fields and properties used by associations, as detailed in this section. Once you have added the generated unit files to your project, you can use their classes and interfaces to manage and query data stores via entity objects. Use the entity model’s CodeGenerationEntityRegistrationType property to choose between available registration methods;

  • Generate a package file (a DPK file) required to compile a package library (a BPL file) that exposes your entity model’s classes for dataset and data context components (TdxEMFDataSet, TdxEMFTable, and TdxEMFDataContext). The DPK file is generated automatically with the unit files described above.