Appendix B. Going forward – NHibernate in Action

Appendix B. Going forward

You’ve reached the end of this book. What remains is for us to give you some guidance and advice that will help you get started and master NHibernate. In this appendix, we enumerate the requirements to use NHibernate. Then, we give you a roadmap to progressively master NHibernate and keep yourself up to date. Finally, we encourage you to discover the internals of NHibernate and to contribute to and help improve NHibernate.

What you need

This book assumes that you have some experience with .NET programming. Before you begin to use NHibernate, you should already have the .NET framework and an Integrated Development Environment (IDE) like Visual Studio or SharpDevelop. Note that you can also use Mono (, which runs on other operating systems like Linux.

The NHibernate binaries, source code, and documentation are available on the NHibernate SourceForge website: ( is a website that provides free hosting for open source software (OSS) development projects.)

Before NHibernate 1.2, two packages were available: nhibernate, containing the core binaries with source code and documentation; and NHibernateContrib, containing optional useful add-ons for NHibernate. Now, the packages have been merged. You’ll need NHibernate 1.2 or later to take advantage of .NET 2.0 generics and nullables.

You can use NHibernate with most popular database systems. The complete list is available at

This is all you need to start using NHibernate.

Practice makes perfect

The next step is to practice using NHibernate, from the simple “Hello World” example in chapter 2 to a more complex application like CaveatEmptor. We highly encourage you to develop your own applications to test the core features of NHibernate and then integrate the advanced features that interest you. At that point, this book will serve as a reference.

Make sure you understand the mapping of entities and their persistence lifecycle and the way NHibernate sessions work. Also be careful of the way you use NHibernate caching. The book’s three final chapters explain how important the application’s architecture is.

Problem solving

You’ll often encounter problems while using NHibernate. In most cases, their source is the misuse of features due to a lack of understanding. For more advice about problem-solving techniques, see section 8.3. Note that a well-thought-out design will help you avoid and solve problems; take time to think about the features you want to use (algorithms) and the architecture of your application (layers, separation of concerns, and so on).

If you’re still unable to overcome your difficulties, feel free to ask for help on the NHibernate forum: Be sure you explain your problem in detail, including logs and error messages.

Staying up to date

NHibernate is constantly evolving. Once you feel comfortable using it, you should keep yourself up to date, because new features can improve your applications’ capabilities and performance. The best way to do that is to regularly read and participate on the NHibernate forum. It’s also a great place to share your point of view about various NHibernate-related problems, get feedback about them, and learn how other people solve them.

Many other informative and useful resources (documentations, samples, and open source projects) are available on the internet. You can find a comprehensive list at

NHibernate has a bug-tracking website: You can register on this website and report any bugs you encounter (if you aren’t sure it’s a bug, use the NHibernate forum first); you can also request new features.

Because NHibernate is OSS, its source code is freely available. Instead of using the compiled library, you can use the source code to gain more details when debugging your application.

Feel free to modify NHibernate whenever you need to, to add a new feature or fix an existing bug. Don’t forget to make this addition publicly available so that other NHibernate users can use and even improve it. You can do so by submitting a patch at the bug-tracking website (a patch is a file that contains the changes you’ve made in the source code).

The bug-tracking website also gives you an idea of the features and bug fixes that are available in the bleeding-edge version of NHibernate (which the NHibernate developers are working on). The source code of this version is hosted by in an SVN repository. If you’re interested in using this version, read “Getting Started with the NHibernate Source Code” at and go to Note that although this version is generally stable, it can temporally become unstable from time to time.

After you begin to use the SVN version of NHibernate, you need to take only one final step to embrace NHibernate completely: joining the development list. This mailing list is used by the developers of NHibernate to discuss its evolution. You can register and read the archive at

This is the end of the book and, we hope, the beginning of a wonderful experience with NHibernate. Bon voyage!