When is the config loaded with nHibernate?

I read that the initial load time for config can be quite long in nHibernate depending on # mapping tables etc.

Is it done once and stored in session or cache?
Will this happen every time the ASP.NET process gets recycled?

0


a source to share


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


Configuration

used to create ISessionFactory

. This is a one-time trade that will occur when the application is launched.



0


a source







All Articles