Adding Your Own Code Templates

You can add your own code templates to Iron Speed Designer.

Where to find code templates

Code templates are found in the Code Customizations folder where you installed Iron Speed Designer, e.g.:

C:\Program Files\Iron Speed\Designer\Code Customizations\vb

There is a “cs” folder for C# code templates and a “vb” folder for Visual Basic .NET code templates.

The sub-folder organization is displayed directly in the Code Customization Wizard.  It’s a useful mechanism for organizing related code templates.

What’s in a code template

Code templates themselves usually have two related files:

For example:

Conditional Table Column Display.html

Conditional Table Column Display.xml

Creating a new code template

The best way to create a new code template is to copy the files from an existing code template and rename them.  This preserves the XML structure of the code template file and makes it easier to edit.  Once copied, modify the code template files to suit your needs.

Customization Types

A variety of customization types are supported.  Select the type appropriate for your customization.

Customization Type

Description

<any customization type>  CCWinvalid

The customization file is not valid, e.g. it has an improper format or a customization with an unrecognized customization type.

BasePage

Usually to apply application wide customizations that apply to all pages, the customization gets added to the BasePage class that all pages derive from.

CSharpPageConstructor

Usually the event hook-ups that get inserted in the “Page Class” constructor.  If the constructor is not there, the constructor code also gets added.

CSharpRecordClassConstructor

Usually the event hook-ups that get inserted in the chosen “Record Class” constructor. If the constructor is not there, the constructor code also gets added.

CSharpRecordControlConstructor

Usually the event hook-ups that get inserted in the chosen “Record Control Class” constructor.  If the constructor is not there, the constructor code also gets added.

CSharpSignInControlConstructor

Usually the event hook-ups that get inserted in the  “SignInControl Class” constructor. If the constructor is not there, the constructor code also gets added.

CSharpTableControlConstructor

Usually the event hook-ups that get inserted in the chosen “Table Control Class” constructor.  If the constructor is not there, the constructor code also gets added.

DataAccessClass  database

Usually new Function or Sub definitions that get added to the end of main class defined within one of the Data Access Layer’s customizable class files.  These modifications usually affect all parts of the app that access a particular database table, rather than just a single page.

InstructionsOnly CCWhelp

A customization that has only an explanation and/or a description of steps to take, and no actual code.

Page  aspx

Usually new Function or Sub definitions that are added to the main “Page” class in the page’s customizable class file.  Page customizations are typically used for life-cycle and other page-related customizations.

RecordClass

This customization is inserted at the end of the calls’ definition for "Record" classes (e.g. "EmployeesRecord.cs").

RecordControl  CCWrow

Usually new Function or Sub definitions that get added to the chosen “Record Control” class that’s defined within a Page’s customizable class file.  RecordControl customizations are typically used for Field Value and other record-related initialization, update customization, etc. that affect Record or Table pages.

SignInControl

Usually a new Function or Sub that gets added to the SignInControl class.

SQLAccessClass  sql

Usually new Function or Sub definitions that get added to the end of the main class defined within a SQL Access Class’s customizable class file.  These modifications usually affect all parts of the app that access a particular database table, rather than just a single page.

TableControl  CCWtable

Usually new Function or Sub definitions that get added to the chosen “Table Control” class defined within a Page’s customizable class file.  TableControl class customizations are typically used for column, format, and other table-related initialization, etc. that affect Table pages.

Note: These customization types require a single "TableName" substitution variable so the Code Customization Wizard can determine which customizable class files to modify.  This is true even when the code customization itself does not need to perform any substitutions with it:

RecordClass
CSharpRecordClassConstructor
DataAccessClass
NewDataAccessClass
SQLAccessClass

Substitution Variable Types

Substitution Variable Type

Description

Button

Lets the user select any bound GEN:Button in the page and use its name as the value of a substitution variable.

ColumnType

Lets the user select any defined column type defined in Iron Speed Base and use its name as the value of a substitution variable.

Control

Lets the user select any bound GEN: tag defined in and application and use its name as the value of a substitution variable.

CrystalReportsClass

Offers a list of all the Crystal Reports classes that are included in the app's project file, i.e. those that correspond to files with .RPT or .rpt extensions.  The class name – the file name without the extension or relative directory path is substituted for this variable.

DropDownList

Lets the user select any bound FieldValue control that has a control type of DropDownList in the page and use its name as the value of a substitution variable.

FieldLabel

Lets the user select any bound FieldLabel in the page and use its name as the value of a substitution variable.

FieldName

Lets the user select the name of any column defined in any table and use its name as the value of a substitution variable.

FieldValue

Lets the user select any bound Field Value in the page and use its name as the value of a substitution variable.

Filter

Lets the user select any bound Filter in the page and use its name as the value of a substitution variable.

RecordControl

Lets the user select any bound GEN: tag defined in the chosen Record Control Class and use its name as the value of a substitution variable.

RecordControlClass

Lets the user chose the record control class where the customization will be added.

Table

Lets the user select any bound GEN:Table in the page and use its name as the value of a substitution variable.

TableControl

Lets the user select any bound GEN: tag defined in the chosen Table Control Class and use its name as the value of a substitution variable.

TableControlClass

Lets the user chose the table control class where the customization will be added

TableName

Lets the user select the name of any table in the application and use its name as the value of a substitution variable.

See Also

The Code Customization Wizard

Selecting a Customization to Apply

Substituting Parameters into a Code Template

Applying the Code Customization to your Application

Adding Your Own Code Templates