When is the config loaded with nHibernate?
2 answers
The config object is usually associated with ISessionFactory. If you have a lot of mapping builds (cfg.BuildSessionFactory is called) the factory session can be slow. Therefore, you only need to create a factory session once and use it throughout your application. In an ASP.NET application, when the process is being recycled, you will lose reference to that factory session and must be restored again.
If you find it is very slow to create a factory session, you can improve performance by disabling the reflection optimizer: Environment.UseReflectionOptimizer = false (cf doc )
+2
a source to share