Code Generation Tool for ORM Mapping

There seems to be no end to the code generation tools, and most likely they won't have to go through each one to see what is still supported, easy to use, and provides customization. Code generation is for mapping NHibernate and then creating value objects or data transfer objects (DTOs). It would be great if it could generate other languages ​​as well, such as an action script.

Since this application being developed uses a database, the ORM is usually a 1: 1 mapping. I know this hits most of the reasons for using NHibernate, but this is what it is.

+1


a source to share


4 answers


T4 is built into Visual Studio 2008. You already have it for free. Works well, fully supported. If you search you can find T4 scripts for Linq To Sql and Entity Framework. I'm pretty sure the NHibernate script exists.

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



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

They are all customizable. Code Smith and T4 are both very similar to me as long as the script is running.

+2


a source


I generally create an XSLT that queries sysobjects connected to syscolumns (one is assumed to be using SQL Server) and transforms the output to build the required structures. This has a disadvantage that you must compile and debug yourself. However, once you get it up and running, you have 100% flexibility to extend and customize it, and the only cost is the time and effort ahead of time (usually around 2-3 days to get an initial working copy).

Hope it helps,



Bill

0


a source


I haven't had time for this yet, but Entity Framework in 4.0 (VS2010, now available in public beta) supports T4 templates for generating code from edmx ... so you can customize it pretty much as you like. "Entity Framework T4 Template" and you will find a lot, especially in the last few days.

0


a source


We used open source NVelocity

0


a source







All Articles