views:

166

answers:

4

Are there any good alternative to NHibernate's xml mappings?

I have seen Fluent. All I look for is high maintainability.

UPDATE : I would like to know the performance issues related with using fluent because I guess it is going to create xml mappings from the class (which can be time consuming - my guess)

Thanks

A: 

I used Linq To XSD to generate a class library from the mapping file xsd definition which gives you statically typed mappings, which you can write helpers and conventions for. The nice thing about it is that the syntax looks very similar to a normal hbm.xml file, while I haven't had the time to learn how to do each mapping in Fluent.

mcintyre321
+2  A: 

I have seen Fluent..

Then go for it!

Fluent is a great alternative. I use NHibernate with Fluent, and it has been working out very well. I find the Fluent Configuration being much more maintainable and nicer than default NHibernate configuration.

Check out the Fluent Wiki - great documentation and a good starting point.

Regarding your edit I can't give you any concrete answers, but I have never seen any performance issues using Fluent myself. I assume NHibernate alone would be slightly faster on startup, but once the mappings are made there should be no difference. Also note that the performance in writing the code will be better due to the simplicity Fluent offers ahead of NHibernate configuration.

stiank81
+4  A: 

Fluent, but then again I would say that.

There's a minor performance impact by using it, but it's got nothing to do with XML generation*. NHibernate has a start-up time of it's own, and fluent only adds a fraction onto that; it's not even worth thinking about unless you're throwing around thousands of mappings (and more specifically, assemblies).

* Fluent's performance impact is actually from calling Assembly.GetTypes() to find any mappings in your assemblies.

James Gregory
A: 

Other options are ActiveRecord and NHibernate.Mapping.Attributes

Mauricio Scheffer