Code Generation Task Viewer

When output has to be generated, either by exporting DDL SQL scripts or by selecting Project -> Generate Source-code from the main menu or by pressing F7, the Code Generation Task Viewer dialog is opened.

Code Generation Task Viewer

The Code Generation Task Viewer

The Code Generation Task Viewer dialog displays for the output type specified (e.g. DDL SQL create / Update scripts or normal source code), the Code Generation Tasks. Per task, the source (e.g. Entity Model, or the name of a Derived Model), the specifics (e.g. .NET version, language, preset etc.) and whether the task is currently valid and enabled are shown. This allows you to generate code from multiple sources (Entity Model, Derived models) with one click of a button.

The Code Generation Task Viewer allows you to edit the specifics (see below) and/or enable the task or not. Only valid tasks can be enabled. If there's one or more code generation task enabled, the user can perform them by click the Perform tasks button. If you want to debug templates, please check the Enable template debugging checkbox. See for more information about debugging templates the Debugging Templates topic.

Per enabled code generation task, the existing code generation pipeline is executed.

Tip

It's not required to generate each task into the same root folder, you can generate the output of each task in completely different folders using different namespaces and even target languages: each task stands on itself with respect to target language, .NET version, namespace and destination folder.

Valid vs. Invalid code generation tasks

A code generation task is valid if all values required for executing the task are available, e.g. namespace, target folder. When you try to generate code for a new project it's likely at least one value required for the task is missing and the task is then marked 'invalid'. To make the task valid, edit the task as shown below, and specify the required values.

Edit code generation task specifics

To edit the code generation task specifics, either double click it in the grid or select it and click the edit button at the bottom of the Code Generaton Task Viewer. Editing a code generation task opens the Code Generation Task Configurator dialog. By default the General settings tab is the only tab visible in the dialog (Simple view). Clicking Advanded... will show the additional tab, the Template Bindings tab.

Clicking OK will fill in the values specified in the edited code generation task. If the task is now valid, it will be marked as valid and can be executed.

The available tabs and their functions are:

General settings
This tab contains the information and selectors for the target language, target platform, root namespace, which template group to use and the root folder in which the output will be placed.
Template bindings
This tab is only visible when Advanced... is clicked on the General Settings tab and contains the template binding files and their current order. Template bindings bind a physical file to a TemplateID. A TemplateID is used by the code generators to select which template to use. You can bind multiple files to the same TemplateID, the one which is not overruled by a different binding due to the order of the template bindings on the Template bindings tab is chosen. Which target platform and which target framework is used in the project determine which template bindings are available.

Order of execution

It's key to have an ordering in the code generation task execution within a cycle: the entity model task is executed before derived model tasks, so the derived model tasks can obtain namespace names etc. properly. If the entity model task is disabled, the other tasks (if available) can still proceed but might not result in compilable code as they depend on elements which aren't generated. It's therefore recommeded to generate all tasks available every time you generate code.