CodeGenTask Class
Represents a single code generation task within a task set.
For an example of generating code with the CodeGen API look here.
Syntax
Class Name: public class CodeGenTask
Namespace: CodeGen.Engine
Assembly: CodeGenEngineShared.dll (later will move into 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. |
Required Properties Set by Calling Application Before Processing
Name |
Type |
Description |
Structures |
List<String> |
The names of one or more repository structures to be processed. |
Templates |
List<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. |
Optional Properties Set by Calling Application Before Processing
Name |
Type |
Description |
Aliases |
List<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. |
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. |
FieldPrefix |
String |
Field prefix. Setting this property is the equivalent of using the -prefix command line option. |
FileOverrides |
List<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. |
GroupNoExpand |
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. |
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. |
IncludeOverlayFields |
Boolean |
Include overlay fields. Setting this property is the equivalent of using the -f o command line option. |
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. |
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. |
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 for this task. The repository files can also be set on the CodeGenTaskSet to specify the same repository for all tasks. Setting this property is the equivalent of setting the RPSMFIL environment variable. |
RepositoryTextFile |
String |
Repository text file to use for this task. The repository files can also be set on the CodeGenTaskSet to specify the same repository for all tasks. Setting this property is the equivalent of setting the RPSTFIL environment variable. |
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. |
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 |
List<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. |
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 |
List<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. |
Copyright © 2018 Synergex International, Inc.