Creating the default instance

Unofficial Content

Creating the default 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. 


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).


Workwithgenerator.cs is within (C:\Program Files\ARTech\Patterns11\Tools\
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.