While XML mapping is undoubtedly the most common mapping method, the fluent NHibernate method is gaining steam. This is a separate project from the main NHibernate project, and you can find out more information about it at http://fluentnhibernate.org/.
Some of the advantages of fluent mapping over XML mapping are as follows:
Compile-time mapping validation: XML is not evaluated by the compiler, so renaming properties in your classes or other errors in your
hbm.xml
mapping would not be detected until you actually run the applicationLess verbose: XML by nature is fairly easy to read because of the number of characters it requires to produce even simple documents, but this makes for huge documents
Fewer repetitions: Instead of writing the same repetitive XML over and over, the fluent interface exposes the advantages of native code
Fluent NHibernate provides these advantages by moving your mappings from XML documents directly into your code. They're compiled along with your application...