Template Bindings Viewer

The Template Bindings Viewer tab

The Template Bindings Viewer tab

Templates are bound to Template IDs by Template Bindings files. During code generation, a task uses a template id to obtain a template file: the template file which is bound to the template id of the task in the template bindings file which has the highest precedence set at the Template Bindings Tab of the Code Generation Task Configurator. To view these template bindings files, to select a template bindings file to edit it or to select the template files to edit in the template editor, you use the TemplateBindings Viewer.

The Template Bindings Viewer is opened by selecting Tools -> Template Bindings Viewer from the main menu, or by clicking the Template Bindings button on the toolbar.

The Template Bindings Viewer consists of three parts: Filters, Found TemplateBindings and the TemplateID - Template filename bindings of the selected TemplateBindings file. These areas are described more in detail below. The Template Bindings Viewer views only templatebindings files which are known by the system. See the section about refreshing code generation meta-data below for how to update the known set of files.

Filter area

There are multiple frameworks supported by the designer, supporting multiple platforms, languages etc. and this results in a lot of templatebindings files. To limit down the list of templatebindings files to select from, the Filters area can be used. When a project is loaded, the target framework of the Entity Model of the project is used to set the Framework filter when the Template Bindings Viewer is opened.

If you don't want to use a particular filter element, select its <Any> option.

Found TemplateBindings area

The Found TemplateBindings area is the area which allows you to work with the templatebindings files which match the filters specified. You can select a templatebindings file from the Name combo box and edit the templatebindings file by clicking Edit. This will bring up the Template Bindings Editor. If you want to edit the templatebindings file in the xml editor (with intellisense), you should instead click Edit as XML. This will bring up the Text Editor with the templatebindings file loaded. To create a new templatebindings file, click the New... button, which will bring up the Template Bindings Editor.

TemplateID - Filename bindings area

This area shows all bindings between Template IDs and template files of the selected templatebindings file in the Name combo box, grouped by output language. This is the language of the output the template will result in, e.g. C# sourcecode. Any file which isn't found is displayed in red.

To edit one or more template files in the Text Editor, select the rows in the grid and either right-click the rows and select Edit selected files... from the context menu or click the button Edit selected files... at the bottom. If one or more files don't exist yet, you'll be notified by that through a message box which will ask you whether these files will be created or not. If you choose not to, no editor is opened for them.

Refreshing Code Generation Meta-data

The designer uses an internal code generation meta-data storage, which contains templatebindings files, framework definition files and other code generation related files read from the default folders and additional folders specified in the project.

When you change these files on disk, the designer doesn't know about these changes until you decide to refresh the internal code generation meta-data storage. To do that, you can select Tools -> Refresh Code Generation Meta-Data from the main menu or click the Refresh button on the toolbar next to the Template Bindings Viewer button.