Skip to main content

Add the Entity Data Model to Run the T4 Text Templates

The module we build will require a database to store information. In the default Eleflex database, create schemas, tables, stored procedures, views and data that is related to your module. For simplicity of this exercise, create a new table called “dbo.Contact” with an integer primary key called “ContactKey” and another string column for “Name.”

The T4 text templates in the generated projects are driven based on an Entity Framework Data Model. When running the templates, it will iterate through the objects in the entity data model and create code files in the project to fulfil the design tiers required by the architecture. When the module generator was run, an Entity Data Model Name was defined in the user interface, the default name is “[Module Name]DB.” This will be the name of the model created.

  1. In the root of the Server project, create a new ADO.NET Entity Data Model with the name from above, as in: “[Module Name]DB.”
  2. Right click and “Run Custom Tool” for all T4 text templates (* files) in the Business, Messages, and Server projects.
  3. In the WebServer project, uncomment the WebServerObjectLocationRegistrationTask.cs.
    • This file was commented out because it relies on objects that need to be generated by the T4 text templates
  4. Rebuild the solution to confirm successful