views:

415

answers:

6

what is the best code generator for NHibernate?

+1  A: 

The soon to be release LLBLGen v3 will be the best code generator for nHibernate (in addition to all the other things it will do). For now, I'd probably use CodeSmith.

Bob
+2  A: 

See the "Helpful Tools For NHibernate" section on this NHibernate page and choose one based on what you're looking for. Do you want free? Commercial? Do you want Visual Studio integration?

All of the listed code generators there are good, there is no general best without knowing what you need.

Gergely Orosz
Note: This page no longer exists.
Mohamed Meligy
A: 

ActiveWriter for NHibernate is the most supported, up to date, free option, although it does an incomplete job.

I put together a quick start guide using Active Writer:

Using Linq with NHibernate : A Quick Start

See also this question:

http://stackoverflow.com/questions/41752/nhibernate-generators

Code Smith appears to be the leading commercial option, although I haven't tried it myself.

Michael Maddox
+1  A: 

I'm using NConstruct; they offer also a free version - NConstruct Lite. I miss SQL 2008 support otherwise I find it very easy to use.

Leo
Edit: SQL 2008 is supported since few months ago.
Leo
A: 

There is a free and open source tool. NHibernate Mapping Generator.

There a new 2.0 Beta 2 release available with lots of new features and support for fluent nhibernate, one-to-many and many-to-many mapping.

http://www.codeplex.com/Wikipage?ProjectName=nmg

Jack