Creating the default instance

Unofficial Content

Creating the default instance

Instance

It is an xml file defining a pattern case; that is to say, it has all the required information that, together with the application of certain programs (templates), will allow you creating an xpz file to be consolidated in GX to create GX objects.   

We start from a transaction of a GX KB.
To obtain all the TRN information and generate the default instance you use the workwith.dll (which is setup in the HelperAssembly property in pattern.definition) and, within it, the GXKnowledgeBase.dll to scan the subordinated tables to know how to generate the Tabs.  
The default instance is created with these classes and the pattern definition (pattern.definition).
The pattern.definition indicates the nodes and values with which the default instance will be generated. 

Image2

To indicate patters what is the class to be used to create the default instance you must setup the DefaultGenerator property in pattern.definition (option Tools / Edit pattern definition).
The DefaultGenerator property has the GXPatterns.WorkWith.WorkWithGenerator value by default (this class is within workwith.dll and uses GXKnowledgeBase.dll).

Imagen3

Workwithgenerator.cs is within gxpatternsources.zip (C:\Program Files\ARTech\Patterns11\Tools\GXPatternsSources.zip).
All sources of every pattern dll are located in this zip. 

As we have already mentioned, an instance is an xml file, and you ?write? this file as you do with any xml; e.g.: if you review workwithgenerator.cs you will find statements like the following: 

AddAttribute(tabNode, "name", subLevel.Description);
To add the Tab node in the instance. 

In this way you will be generating the corresponding xml, with each one of its nodes. Later, you will visualize it easier in the Tree View.

Definition Files

And there is also the patterns definition. 
These definitions are in pattern.definition, which indicates the nodes and properties that will appear in the default instance on applying the pattern, among other things. 

Imagen4