NHibernate startup time is very long. Big part of this is related to parsing xml mappings while building configuration object. Solution for this is reading configuration object from cache as described by other people: http://wiki.sharparchitecture.net/%28S%28qrglpv55m25xhx55fukhzg55%29%29/Default.aspx?Page=NHibernate%20Configuration%20Cache&AspxAutoDetectCookieSupport=1 or http://entron.wordpress.com/2010/01/06/optimizing-application-startup-time-with-fluent-nhibernate-and-unhaddins/
Unfortunately with Spring.NET it can't be done. For my own needs I've modified source code of Spring.NET to do that. It was enough to change signature of LocalSessionFactoryObject.PostProcessConfiguration method. I've just added ref keyword to the parameter. Then I've used modified class as attached (I'm also using Fuent NHibernation).
This is simple but not very good solution - because I think that PostProcessConfiguration should not be used for this purpose under current name.
Anyway similar functionality is necessary.
Maybe it would be enough to provide 3 additional virtual methods in LocalSessionFactoryObject:
- IsConfigurationFileValid with default implementation returning true;
- SaveConfiguration - empty;
- LoadConfiguration - returning NotImplemented exception
and then one could override this with custom caching implementation?