5 Principles - non-negotiable for code generation:
Principle #1 :
You have control of the templates that generate your code and can change or replace them as required.
Principle #2 :
You collect metadata as a separate, distinct step with usable output that can independently evolve.
Principle #3 : You, or someone unfamiliar with project, can regenerate
your code precisely as a one-click process—now or at any point in the future.
Principle #4 : You embrace handcrafted code by isolating and protecting it.
Code generation is a supporting player to human programming and doesn’t overwrite files unless they were generated and haven’t been edited.
Principle #5 :
The code-generated application is a high-quality application. It allows more effective testing, has equal or better performance, and is more easily maintained than a similar fully handcrafted application.
T4 (Text Template Transformation Toolkit) - the code generation engine used as part of Domain Specific Languages and Software Factories projects. With the T4 toolkit now built directly into Visual Studio 2008, you can easily add code generation to your arsenal
Microsoft Entity Framework - .NET 3.5 SP1
Software Factories – SCSF, WSSF etc.
Class Library project and a class that implements the IDTWizard interface in VS2008
CodeSmith is a software development tool to help you get your job done faster. Technically speaking it is a template driven source code generator that automates the creation of common application source code for any language (C#, Java, VB, PHP, ASP.NET, SQL, etc.).
CodeSmith's syntax is almost identical to ASP.NET. So if you are familiar with ASP.NET then you should be able to quickly learn the template syntax. You can use the C#, VB.NET or JScript.NET languages in your templates and your templates can output any ASCII-based language.
“ I have several clients that have used CodeSmith in the past with great success. We even have some internal projects here at Microsoft that have utilized it for non-shipping code. Feel free to mention that even Microsoft has used it & you received a note from a contact too on this topic on being used in industry.“