Tuesday 29 November 2011

Mini Review: NHibernate 3 Beginner’s Guide

I’ve recently re-discovered the pleasure of reading in bed, thanks to my new iPad, which, with its backlit screen, allows me to snuggle under the covers with a good book without disturbing my wife. Packt Publishing kindly provided my bedtime reading for the last few nights - NHibernate 3 Beginner's Guide by Dr. Gabriel Nicolas Schenker and Aaron Cure.

nhibernateThis is a book I wish I’d had three years ago. Back then I was sketching designs for a database-heavy application, and I evaluated Nhibernate, but was put off by its steep learning curve, and skimpy documentation. The documentation has improved immensely in the years since, and NHibernate itself has got easier to use, but it can still appear daunting for someone just getting started.

This book makes Nhibernate approachable for the absolute beginner, even one who is relatively new to database technologies. The author explains key concepts carefully, and drives lessons home with plenty of comprehensive step-by-step tutorials.

What I particularly liked was the inclusion of the Nhibernate ecosystem: FluentNhibernate (in my opinion the best mechanism for configuring NHibernate) is given good treatment, as is NHProf, a commercial Nhibernate profiling tool. It was also nice to see an introduction to unit testing NHibernate data access layers.

One area that I did feel was a little weak was the section on setting up mappings. The author gives examples of three different ways in which mappings can be configured, but doesn't cover important aspects like cascading updates in much detail at all – something I’ve been caught out by several times, and an area on which I would have appreciated some friendly guidance when I was starting out. Have a look at NHibernate in Action if you want to dig in more deeply here.

This book definitely goes on my list to recommend to anybody starting out with NHibernate development.