https://github.com/byjg/codegenx
Code generator highly flexible and extensible based on Torque XML and XSL transformations
https://github.com/byjg/codegenx
Last synced: 6 months ago
JSON representation
Code generator highly flexible and extensible based on Torque XML and XSL transformations
- Host: GitHub
- URL: https://github.com/byjg/codegenx
- Owner: byjg
- Created: 2013-07-13T21:55:39.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-03T22:32:51.000Z (over 11 years ago)
- Last Synced: 2025-03-29T16:22:54.773Z (6 months ago)
- Language: C#
- Size: 324 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CodeGenX
========Code generator highly flexible and extensible based on Torque XML and XSL transformations
## Introducing to CodeGenX
CodeGenX is a Code generator highly flexible and extensible based on Torque XML and XSL transformations. You virtually can generate code targeted to any programming language just using your own XSL template.
## Some CodeGenX features
* Generate a single file from each table in Torque XML
* Custom code added by user are not replaced when the CodeGenX generate the file again
* Custom parameters for each table
* Save a project for you codegen
* Very fast!
* Lightweight
* Run in Windows (.NET) or Linux (Mono)## Generate code with CodeGenX
The first step is create a Torque XML. You can create your own XML file or you can use a tool to do this for you. We recommend Druid. Druid from Sourceforge is a database modeling tool and it have some specific features like generate a documentation from your database and export to Torque XML file. But if you know any other tool, let me know. The Torque XML will be like this:
````XML
````
After that, you have to create a XSL file. We know XSL is not a user friendly language, but it is powerful to transform a XML in any other thing you want. To make the things easier we recommend you create a XSL using the model below:
````XSLT
]>
````
This is a suggestion. You can use any XSL you want.
Here you can see how you can handle the Torque XML file:
````XSLT
class
{
protected $_;public get()
{
return $this->_;
}
public set($value)
{
$this->_ = $value;
}
}
````and the result code will be:
````PHP
class mytable
{
protected $_id;public getid()
{
return $this->_id;
}
public setid($value)
{
$this->_id = $value;
}
protected $_title;public gettitle()
{
return $this->_title;
}
public settitle($value)
{
$this->_title = $value;
}
}
````