The template system

Preface

LLBLGen Pro uses templates to generate the code for the different classes. Templates are stored per target framework and eventually per database if a template is database specific.

Templates are bound to templateID's and these bindings are stored in templatebindings files, stored in Templates folders inside a target framework's folder. Templatebindings files contain language specific bindings, and the languages defined are stored in language files which contain target language specific information. Templatebindings files define template bindings which define a relationship between a template ID and a template file. Tasks should be kept language and template independent and refer to template ID's. By binding a template file to these template IDs, the task performers which use / consume templates, can load the correct template file at runtime.

Template pre-processor and includes

The TDL parser and .lpt template parser contain a pre-processor which is able to process <# templateID #> tokens. These tokens are include statements which include the template file bound to the specified templateID at the spot of the <# templateID #> include token. Included templates can contain include statements as well, cyclic references are ignored. The pre-processor is executed prior to the execution of the including template itself and results in a complete template file with all the included templates embedded into it, which is then parsed by the parser used and executed

Template related XML file formats

Below you'll find the XML formats for the .templatebindings and .language files. To edit them, drag them onto the LLBLGen Pro designer to open them in the template editor. .templatebindings files are stored in the Templates folder of a target framework and .language files are stored in the Shared\Templates folder inside the general Frameworks folder, as they're shared among all frameworks supported. You can also store them in the additional templates folder specified in the project properties.

.Language files XML format
A Language Definition contains programming / output language aspects to be used by task performers. This way, a task performer can test on these definition's aspects without having to 'cheat' by testing other aspects to determine what the target language is for a given task.

A language definition is defined in a .language file and is defined in XML. The format is below. An example is C#.language and VBNet.language. Language files are placed in the Templates folder in the LLBLGen Pro installation folder and additional Templates folders.
<language
	name=""
	fileExtension=""
	arrayIndexOperatorOpenChar=""
	arrayIndexOperatorCloseChar=""
	hasArrayIndexOperatorOnIdentifier="bool"
	lineConcatenator=""
	attributeAssignmentOperator=""
	attributePattern=""
>
	<keywords>
		<keyword name="" value=""/>
	</keywords>
</language>

Attribute descriptions
Child tags descriptions
Predefined keyword names
The following list are predefined keyword names used by the LLBLGen Pro system.
.Templatebindings files XML format
<templateBindings 
	name="" 
	databaseDriverID="" 
	description="" 
	precedenceLevel="0"
>
	<supportedPlatforms>
		<platform name=""/>
	</supportedPlatforms>
	<supportedFrameworks>
		<framework name="target framework name"/>
		<!-- more -->
	</supportedFrameworks>
	<language name="">
		<templateBinding templateID="" filename="" templateLanguage="" includeOnly="true/false"/>
		<!-- more -->
	</language>
</templateBindings>
Attribute descriptions
Child tag descriptions

LLBLGen Pro v4.2 SDK documentation. ©2002-2014 Solutions Design