Quote:
The check for the HttpContext is to help when unit testing
Interesting. In my case the framework I'm developing will be used in both ASP.NET and in other non-web based environments, so doing the check allows me to make a descision about where I store the factory and session with easy access from the domain objects based on the environment I'm running under.
You may not be using it that way, but it certainly helps for me, so thanks for helping consolidate the idea! :)
The main reason that I want to hide the NHibernate functionality from the consumer of my framework is that the users of the framework should know nothing at all about the persistence of the objects. If they had access to the session then they could start breaking functionality while using it, which could leave behind nasty little surprises in the DB.
Cheers,
Symon.