Rishabh Ohri
Rishabh Ohri

Reputation: 1310

Tools for NHibernate

Can anyone throw some light on tools that can be used with NHibernate and which perform the below mentioned tasks:

  1. Generates the Mapping File
  2. Generates the Entity Class
  3. Generates the Configuration file

And also provide information whether these tools are open source or licensed. Thanks

Upvotes: 3

Views: 2727

Answers (4)

scotru
scotru

Reputation: 2606

Check out LLBLGen Pro. It's got a competing ORM but can also act as a code generator for nhibernate. Very good for DB first work.

Upvotes: 0

Ricardo Peres
Ricardo Peres

Reputation: 14555

I really like Visual NHibernate (http://www.slyce.com/VisualNHibernate/). Not free, but has a nice set of features, including the definition of templates for the entities, and generating both HBM.XML as well as Fluent NHibernate mappings.

Upvotes: 1

Chris Conway
Chris Conway

Reputation: 16529

One tool I've used that did a decent job was CodeSmith. It looked at the existing database and created the entities, mappings and configuration file. However, this is only to be used as a starting point as there are many tweaks you'll likely want to do to make it more usable and better performing. Things such as when to lazy load vs. eager load, creating subclasses or components. This tool really just mimics the database structure in your entities which is not always the best way to represent in code.

This is a licensed solution but it includes a fully functional demo you can use to gen your files initially. After that, you'll most likely just enhance just as you would your database.

Another is MyGeneration. Same thing, it'll get you 75% of the way there in most cases.

Just be cautious as to which version of NHibernate these tools are producing. They may be using an older version which may have some obsolete code.

Upvotes: 3

PHeiberg
PHeiberg

Reputation: 29851

A similar question with some answers you might find useful is already on SO. NHibernate Generators

As mentioned in that question's answers, fluent NHibernate is a good option. It just went RTM. You can find more info at http://fluentnhibernate.org/

Upvotes: 0

Related Questions