We are in the process of refactoring an ASP.NET WebForms application to ASP.NET MVC (3). We defined our mappings in the usual ClassName.hbm.xml format. But now we find that this seems a little redundant with the attributes you can specify on the class properties with MVC.
Is there a nice and clean way of telling NHibernate to use the attributes to buid the mappings, instead of using the XML files?
Take a look at fluent Nhibernate. You can use this to configure your mappings through code with minimal effort.
You can also use it read attributes declared on your classes and set up mappings appropriately (see http://mookid.dk/oncode/archives/139 for an example)