CodeGen Documentation
CodeGen Documentation

CodeGenTask

 

Represents a single code generation task within a task set.

For an example of generating code with the CodeGen API look here.

Syntax

Definition:           public class CodeGenTask

Namespace:          CodeGen.Engine

Assembly:          CodeGenEngine.dll

Constructors

Name

Description

CodeGenTask

 

Initializes a new instance of the CodeGenTask class.

CodeGenTask(String, String)

 

Initializes a new instance of the CodeGenTask class for a specified template and structure.

Properties Set by Calling Application Before Processing

Name

Type

Description

Aliases

@ObservableCollection<string>

The alias names for one or more structures. The number of aliases specified must be less than or equal to the number of structures specified via the Structures property. Setting this property is the equivalent of using the -a command line option. If a task does not list aliases but the TaskSet does then those aliases will be used.

 

AllowTemplateFolder

Boolean

Allow template files to specify an output sub-folder. If this property is false then any <CODEGEN_FOLDER> tokens will be ignored. Setting this property to true is the equivalent to using the -tf command line option.

 

AlwaysLoadDefaultButtons

Boolean

Always load default button definitions from DefaultButtons.xml even if processing a UI Toolkit input window definition which may provide button definitions. Setting this property is the equivalent of using the -ba command line option.

 

CharacterHeight

int

The height of a character in pixels. This property can be used to override the default character height which is 25 pixels. Setting this property is the equivalent of using the -ch command line option.

 

CharacterWidth

int

The width of a character in pixels. This property can be used to override the default character width which is 12 pixels. Setting this property is the equivalent of using the -cw command line option.

 

Description

 

String

A description of the task. Not used by CodeGen, but it may be useful for consuming code to display task descriptions in their UI. There is no command-line equivalent to this property.

 

DontAppendFolderToNamespace

 

Boolean

When using a template defined folder name, that name is usually appended to the end of any namespace that is used. This option prevents that from happening. Setting this property to true is the equivalent to using the -nf command line option.

 

ExplicitGroupNoExpand

 

Boolean

Don't expand explicit groups to individual fields. Setting this property to true is equivalent to using the -g e command line option.

 

FieldPrefix

 

String

Field prefix. Setting this property is the equivalent of using the -prefix command line option.

FileOverrides

@ObservableCollection<string>

File Overrides. Allows you to specify which repository file definition is used for each structure being processing. This option is useful if the structure that you are using is assigned to multiple files because by default CodeGen will use the first assigned file. The number of file overrides provided must be less than or equal to the number of structures specified via the Structures property. Setting this property is the equivalent of using the -fo command line option.

 

GroupFieldNoGroupPrefix

 

Boolean

Don't prefix group fields with group name. Setting this property is the equivalent of using the -g f command line option.

GroupFieldNoRpsPrefix

 

Boolean

Don't use repository group field prefix. Setting this property is the equivalent of using the -g r command line option.

ImplicitGroupNoExpand

 

Boolean

Don't expand implicit groups to individual fields. Setting this property is the equivalent of using the -g i command line option.

HonorExcludeReportWriter

 

Boolean

Exclude fields which are "Excluded by ReportWriter". Setting this property is the equivalent of using the -f r command line option.

HonorExcludeToolkit

 

Boolean

Exclude fields which are "Excluded by Toolkit". Setting this property is the equivalent of using the -f t command line option.

HonorExcludeWeb

 

Boolean

Exclude fields which are "Excluded by Web". Setting this property is the equivalent of using the -f w command line option.

IncludeOverlayFields

 

Boolean

Include overlay fields when processing field loops. Setting this property to true is equivalent to using the -f o command line option.

IgnoreExcludeLanguage

 

Boolean

Exclude fields which are "Excluded by Web". Setting this property is the equivalent of using the -f l command line option.

IgnoreScriptFieldAttributes

Boolean

When processing input from a UI Toolkit Window script file this option prevents script file input window field attributes from being used to override repository field attributes. This allows you to generate code based on only the fields listed in an input window, but using only the repository field definitions. Setting this property is the equivalent of using the -wn command line option.

 

MethodCatalogExcludeMethods

@ObservableCollection<string>

The names of one or more methods in the Synergy method catalog interface to exclude. Setting this property is equivalent to using the -mexclude command line option.

 

MethodCatalogFile

String

The synergy method catalog XML export file to process. Setting this property is equivalent to using the -smc command line option.

 

MethodCatalogIncludeMethods

@ObservableCollection<string>

The names of one or more methods in the Synergy method catalog interface to include. Setting this property is equivalent to using the -minclude command line option.

 

MethodCatalogInterface

String

The name of the method catalog interface to process. Setting this property is equivalent to using the -interface command line option.

 

MethodCatalogInterfaces

@ObservableCollection<string>

The names of one or more interfaces in the Synergy method catalog to process. Setting this property is equivalent to using the -iloop command line option.

 

MethodCatalogStructureMode

 

Boolean

The name of the method catalog interface to process. Setting this property is the equivalent of using the -interface command line option, and it can only be used in conjunction with the CodeGenTaskSet.MethodCatalog property (-smc).

 

MultipleStructures

Boolean

Multiple Structures. Specifies that the structures that follow the -s command line option should all be available to templates being processed, at the same time. Setting this property is the equivalent of using the -ms command line option.

 

MultiWriteFiles

 

Boolean

Multi-write file if same file generated more than once. Setting this property is the equivalent of using the -mw command line option.

Namespace

String

Namespace to use when replacing the <NAMESPACE> token. Codegen will determine the default namespace using the environment variable SYNDEFNS. Setting this property is the equivalent of using the -n command line option.

 

NeverLoadAnyButtons

Boolean

Never load any buttons (from DefaultButtons.xml or from a window script). Setting this property is the equivalent of using the -bn command line option.

 

NeverLoadDefaultButtons

 

Boolean

Never use the default buttons defined in DefaultButtons.xml. Setting this property is the equivalent of using the -bd command line option.

NoCustomPluralization

 

Boolean

Suppresses the features of the <STRUCTURE_PLURAL> and <STRUCTURE_NOPLURAL> tokens, making them behave the same as <STRUCTURE_NAME>. Setting this property is the equivalent of using the -ncp command line option.

 

OutputFolder

String

Output directory. Defaults to the current directory, or the directory specified with the CODEGEN_OUTDIR environment variable. You can use a full or relative path, or a logical followed by a colon (e.g. SRC:). Setting this property is the equivalent of using the -o  command line option.

 

PreProcessUserTokens

 

Boolean

Should we treat user-defined tokens as pre-processor tokens. If this property is set to true then user-defined tokens will be expanded out

to other tokens during tokenization, thus making it possible for the value of user defined tokens to contain other tokens. Setting this property to true is equivalent to using the -utpp command line option.

 

PreserveArrays

 

Boolean

Should array fields be preserved instead of expanded to multiple fields. Setting this property is equivalent to using the -pa command line option.

 

PrimaryKeyNumber

 

int

Overrides the key that is used within primary key blocks. Setting this property is the equivalent of using the -opk command line option.

ReplaceFiles

 

Boolean

Replace existing files.  By default existing files are not replaced. Setting this property is the equivalent of using the -r command line option.

RepositoryFile

String

Repository file name to process. This option causes all structures that are assigned to the file definition to be available for use when processing templates. The result is the same as specifying multiple structures via the Structures property and setting the MultipleStructures property to true. Setting this property is the equivalent of using the -file command line option.

 

RepositoryMainFile

String

Repository main file to use only for this task. The repository main file can also be set via the CodeGenTaskSet.RepositoryMainFile property which specifies the same repository main file for all tasks. Setting this property is also the equivalent of setting the RPSMFIL environment variable.

 

RepositoryTextFile

String

Repository text file to use only for this task. The repository text file can also be set via the CodeGenTaskSet.RepositoryTextFile property which specifies the same repository text file for all tasks. Setting this property is also the equivalent of setting the RPSTFIL environment variable.

 

RepositoryOverrideFile

 

String

Specifies the name of a repository override file. Setting this property is the equivalent of using the -rpsoverride command line option.

SelectionWindowScript

String

Window script selection list processing. When this option is used CodeGen will examine any fields which have selection windows specified and will attempt to populate the field selections property based on the selection items defined in the named selection window. Setting this property is the equivalent of using the -ws command line option.

 

Structures

 

@ObservableCollection<string>

The names of one or more repository structures to be processed. If no structures are specified but the TaskSet does specify structures then those structures will be used. Setting this property is the equivalent of using the -s command line option.

 

Subset

String

Subset of fields to use. Specify subsets in field user text strings with @SUB=name; syntax. Setting this property is the equivalent of using the -subset command line option.

 

SubsetFields

 

@ObservableCollection<Tuple<String, String>>

Create a subset from the list of supplied fields. Setting this property is the equivalent of using the -fields command line option.

TemplateFolder

String

Input file directory containing templates. Defaults to the current directory, or the directory specified with the CODEGEN_TPLDIR environment variable. You can specify a full or relative path, or a logical name followed by a colon (e.g. TPL:). Setting this property is the equivalent of using the -i command line option.

 

Templates

 

@ObservableCollection<string>

The names of one or more template files to be processed. Specify only the base file name, not including the location or file extension. Setting this property is the equivalent of using the -t command line option.

 

Tweaks

 

@ObservableCollection<string>

This is a named collection of special "tweaks" to be applied when generating code. Setting this property is the equivalent to using the -tweaks command line option.

UseAlternateFieldNames

 

Boolean

Should alternate field names be used? Setting this property is the equivalent of using the -af command line option.

UseAlternateStructureNames

 

Boolean

Should alternate structure names be used?  Setting this property is the equivalent of using the -as command line option. This option may not be combined with structure aliasing (-a).

 

UserTokenFile

String

User defined token file. Specify a full or relative file spec of the file that contains user defined token definitions. The file spec can include Synergy logical names. Setting this property is the equivalent of using the -u command line option.

 

UserTokens

 

@ObservableCollection<UserToken>

User defined tokens. Setting this property is the equivalent of using the -ut command line option.

WindowScript

String

Process input from a UI Toolkit Window script file. By default the fields and buttons collection will be based on the first input window found in the script file, but this can be overridden using the #n qualifier, which specifies either a 1-based input window number or the name of the input window to process. Setting this property is the equivalent of using the -w command line option.

 

Properties Set by CodeGenerator During Processing

Name

Type

Description

Complete

 

Boolean

Indicates whether the task completed without any errors and warnings.

Errors

 

int

Number of errors reported while processing the task.

FilesFailed

 

int

Number of files that failed to generate while processing the task.

FilesGenerated

 

ObservableCollection<String>

Names of files that were generated while processing the task.

FilesProvided

 

ObservableCollection<String>

Names of additional files that were provided while processing the task.

LastErrorMessage

 

String

The last error message that was reported while processing the task.

Messages

 

ObservableCollection<String>

All messages that were reported while processing the task.

Warnings

 

int

Number of warnings reported while processing the task.

Events Raised During Processing

Name

Description

StartingTask

 

Raised by CodeGenerator just before it starts processing the task.

TaskComplete

 

Raised by CodeGenerator just after it finishes processing the task.

TaskMessage

 

A message was just added to the Messages collection.

 

 

 


Copyright © 2021  Synergex International, Inc.