The Pattern Builder is a tool that is installed with the GeneXus Platform SDK (available from GeneXus X Platform SDK Upgrade #3) and is executed within Visual Studio 2005|2008.
The wizard provided in the pattern builder allows creating, in just a few steps, new patterns for GeneXus X .
The wizard prompts you for this information:
-
Objects to which the pattern will be applied
-
Objects to be generated
Then, it generates a Visual Studio project for creating the pattern, with all the xml files and the configured environment.
Next, with the Template Editor and CodeGen included in the GeneXus X SDK, you can continue to develop the pattern.
The Template Editor can be used to edit the templates from within Visual Studio and CodeGen facilitates the generation of the classes to manipulate the instances. It generates generic xml files so that the developer can continue to develop these files.
Select New Project, and in the project window choose GeneXus Pattern.
Write the name and route where the Pattern will be generated:
Step 1
Indicate the Company name.
Step 2
Indicate which objects the patterns will be applied to (parent objects).
Step 3
Select which objects will be generated by the pattern and their names.
Once you complete the Wizard, the Pattern Builder generates a Visual Studio project with all the files and configurations necessary to continue to develop the pattern.
The Pattern Builder generates a template file for each part of the object to be generated. .
In the example, we indicated that the pattern will generate a procedure. Therefore, the following templates were generated:
-
ExportConditions.dkt
-
ExportLayout.dkt
-
ExportProcedure.dkt
-
ExportRules.dkt
-
ExportVariables.dkt
Each one of them represents one part of the object, and in each one of them we should include the necessary code to generate what we want in that part.
The Template Editor makes editing the templates easier by allowing you to manipulate the files more easily.
In the Visual Studio project, they are the files located under the Template folder:
After you finish developing the templates, select the project's Build option:
When Building the project, the CodeGen is executed, which is a utility that allows generating extensible classes for accessing the instances. This can viewed in the Visual Studio output.
Next, all the necessary files are copied under the GeneXus directory. Thus, upon executing GeneXus the new pattern will be displayed that is associated with the object set as parent object, and in Preferences / Pattern there will be a file corresponding to the default instance of the new Pattern.