views:

4060

answers:

9

Are there any free tools to help simplify working with an NHibernate project in .NET 3.5? Primarily, I'm looking for some kind of code and config file generator to automate some of the more tedious parts of working with NHibernate.

+3  A: 

ActiveWriter is a plugin to Visual Studio that generates some files for NHibernate, but I haven't had a chance to dig into it yet.

Mark Struzinski
+2  A: 

MyGeneration has some nHibernate tempates for code generation.

There used to be some for the free version of Code-Smith too, but I don't think they have been updated in a while.

Brian Schmitt
+3  A: 

NHibernate Query Analyzer is a must for constructing queries. It's not for configuration, I know, but a must when trying to get your head around HQL.

Christian Dalager
NQA does appear to have support for configuration specifically for editing mapping files: http://stackoverflow.com/questions/528707/hibernate-nhibernate-mapping-file-editor/739835#739835
Ray Vega
+3  A: 

What about an active record implementation with attribute-based definition on top of nhibernate?

Cristian Libardo
I was actually just looking at that. :)
Jason Baker
+8  A: 

Fluent-NHibernate presents an alternative way of writing your mapping, that for example is more refactor friendly than the standard XML approach.

Example:

public CustomerMap : ClassMap<Customer>
{
  public CustomerMap()
  {
    Id(x => x.ID);
    Map(x => x.Name);
    Map(x => x.Credit);
    HasMany<Product>(x => x.Products)
      .AsBag();
    Component<Address>(x => x.Address, m =>  
    {  
        m.Map(x => x.AddressLine1);  
        m.Map(x => x.AddressLine2);  
        m.Map(x => x.CityName);  
        m.Map(x => x.CountryName);  
    });
}
Erik Öjebo
I like that. Thanks for mentioning it.
Jason Baker
I think this'll be what I'm going to go with. I really hate dealing with XML files.
Jason Baker
Glad I could help!
Erik Öjebo
+3  A: 

Keep an eye out for Oren (Ayende)'s NHhibernate Profiler:

http://ayende.com/Blog/archive/2008/11/04/nh-prof-a-guided-tour.aspx

It is not yet released but it looks very promising.

David P
+3  A: 

David Hayden has put together T4 Templates that generate sample Fluent NHibernate Mapping Classes.

http://codebetter.com/blogs/david.hayden/archive/2008/12/14/t4-templates-for-fluent-nhibernate.aspx

+2  A: 

what about NConstruct Lite, a small powerfull tool to generating mapping files and Entities...

Guy Fomi
A: 

Have a look at: dPulpo, a datalayer generation tool that generates NHibernate mapping files, C# entity classes and your SQL database. There is a Visual Studio plugin and it's currently in beta and free for download.

pvolders