I've got to develop a multi-language code generator in C#. Well actually the idea is, we have several in house application frameworks for database access in various languages (Java, Python, C++). But their basic working principle is same. And we feel that a code generator will help us to reduce our development time. So I have decided to write a code generator for the ease of our development.
What are the standard basic technical steps I should follow to generate classes from database tables?
Should I use \t
,\r
,\n
?
What are the techniques to achieve fastest speed?
I don't want to use RegEx.
Please let me know from your personal experience.
It really depends on what you mean; there are lots of options:
In all cases, I would build a basic object-model that represents the data and work from there. I have known somebody write code-gen from a database just with SELECT
, but it was ugly as sin, and painful in the extreme to maintain.
Re your questions about \t
, \r
, \n
etc - I don't understand the question, but: whatever the target language wants! VB is the tricky one here (C# etc are easier as they don't care much about whitespace).
I've used xslt successfully, but largely because I already knew xslt, and needed to support 2.0 (T4 isn't in 2.0); otherwise T4 would have been my next stab, simply because I want to learn it ;-p