
April 23, 2010 01:03 by
Simon
It's never been 100% clear to me when using second level cache with NHibernate, when NHibernate accesses the cache and when it needs to go to the database directly. There is a great explanation of how NHibernate uses caching in The NHibernate FAQ, but even after reading this, I still wasn't completely clear on when NHibernate has to hit the database, so I went about testing it out myself. Below are the results of my testing; I was using NHibernate 2.1.2.400, FluentNHibernate 1.0.0.629, SQLServer 2008 and NCache 3.6. I created a single test consisting of each of the code snippets below and I set the NHibernate show_sql configuration parameter to true so that I could see when NHibernate hit the database. I also created an IClassConvention that tells NHibernate to cache all entities as read write (in reality I would probably be more granular than this). More...
84e43cb7-41bd-4dd5-813c-f2c49e938630|0|.0

February 22, 2009 13:00 by
Simon
I had a similar problem to solve in .Net to the one I solved in Java using the ServiceLocator class. I moved the NHibernateSessionManager to a library but needed a way of registering project specific interceptors. Here is the code:More...
902379c3-95d2-4fe8-8e9b-fd65d60b464c|0|.0