Implementing Unit Of Work with NHibernate
August 31, 2009
The more I work with NHibernate, the more I question why I wrote so much SQL in the past. It feels… unnecessary. Who said “stupid”? Not me…
Jimmy Nilsson once said, “I just want the database and storage problems to be a consequence of my domain model. I don’t want to think about it.” This aligns with one of the goals of Domain-Driven Design (DDD), and NHibernate is a key tool in achieving this.
I’ve been experimenting with NHibernate recently, and I’m genuinely impressed. While the mapping files can be complex initially and there are many tricks and traps to navigate, NHibernate is truly powerful.
Here are some resources that have been particularly helpful in my journey:
- The NHibernate API Reference
- A great tutorial for getting started
- A series of articles on implementing the Unit of Work pattern with NHibernate: Part 1, Part 2,...