You need to download the AjGenesis binaries (trunk version) from AjGenesisTrunkBinaries.zip, expand them, AND add the bin folder to your path.

There is the command PrintEntities.cmd:

AjGenesis.Console Project.xml PrintEntities.ajg

AjGenesis.Console is the console program that launch the AjGenesis process. It receives many arguments. If the argument is an .xml file, its content is loaded in memory as an AjGenesis model (explained below). If the argument is an .ajg, the content of the file is a task, a list of commands to execute in AjGenesis. The commands are written in an interpreted language, named AjBasic.

This is the content of Project.xml (read previous post for more details):

<Project><Name>AjApp</Name><Description>Building an Application using AjGenesis</Description><Model><Entities><EntitySource="Customer.xml"/><EntitySource="Supplier.xml"/></Entities></Model></Project>

Once the model is loaded in memory, there is a public variable Project with dynamic properties loaded for each attribute and element. From AjBasic, we can access Project, Project.Model, and Project.Model.Entities.

A template is a text file with the content to generate, and with fragments between <# and #> that are filled with AjBasic commands. In the above template, the for each command processes each of the properties in the current entity. As in the string expansion, expressions between ${ and } are evaluated and its results are inserted in the output of template process.

This is the output generated for Customer.cs using EntityClass.tpl template:

There are still some simplifications: no namespace, all properties are strings, no id for entities, etc… I will address these issues, step by step, in future posts. Next steps: generate, from the same model, C#, VB.NET or Java class files.