Fluent NHibernate. Fluent NHibernate and those sweet LINQ repositories. Fluent NHibernate is a tool that lets you easily write NHibernate mappings. I downloaded the code and was awe-struck. It's really tidy and full of nicely implemented ideas. ####In-Memory Repository One of them was the in-memory repository class. It uses LINQ for queries, and keeps an in-memory cache of objects. Gotta love the Star-Wars geekery :) This kind of repository is useful for testing domain logic without hitting the DB. ####LINQ for NHIbernate Repository Jeremy has also created a real repository that implements the same interface as the in-memory one. Here's the real repository in action: There are currently only 9 integration tests that actually use NHIbernate and hit a DB. ####Lots to Learn There's a lot to learn from this project. One thing is that not hitting a database for 90% of your tests is a GREAT THING. In this project, the 9 tests that hit the database take a whopping 7 seconds to run on my machine!
####Favourite Mapping Technique? Fluent-nhibernate - Google Code. XmlDocument fluent interface.