C# – code generation tool for ORM mapping

ccode generationnhibernate

There seems to be no end of code generation tools out there and would rather not have to go through each to see what is still maintained, easy to use, and provides customization.
The code generation is for NHibernate mapping and subsequent creation of value objects or Data Transfer objects (DTO). It would be great if it could also generate in other languages such as action script.

As this app being developed is using the database the ORM is generally a 1:1 mapping. I know that this defeats most of reasons of using NHibernate but that is what it is.

Best Answer

T4 -- built into Visual Studio 2008. You've already got it for free. Works well, fully supported. If you do some searching you can find T4 scripts for Linq To Sql, and Entity Framework. I'm sure an NHibernate script exists as well.

MyGeneration: Open Source, also very good. No Visual Studio integration.

Code Smith: Commercial, does the job very well. Also integrates into Visual Studio.

All of them are customizable. Code Smith and T4 are both very similar to me as far as the script goes.