On the sad state of NHibernate code generation

time to read 1 min | 182 words

I wanted to generate NHibernate mapping & objects from the Northwind schema, to be able to run the same queries as the Linq samples.  I evaluated several MyGeneration templates as well as a commerical product (GenWise). None of them had an output that I would dim acceptable.

What od I mean by that?

  • Singularizing the table names when creating an entity.
  • Properties names that follow the .NET Naming Guidelines.
  • Able to generate many to one <set>

I like code generation in general, but I know that there are many people who swear by it. And come on, it is Northwind, the database equivalent of Hello World. Are there any reasonable code generation tools for NHibernate? 

If there isn't, I am willing to trade, a Linq implementation for a code generator that can handle the Northwind database.