0
votes

Is there a way to avoid recreating the NHibernate SessionFactory every time an ASP.NET application restarts?

I have already implemented the solution where the Confguration object is serialized and written to disk so it can be restored.

http://lucisferre.net/2009/06/18/speed-up-nhibernate-startup-with-object-serialization/

Great improvement, but still takes 6-7 secondes to create the session factory from an existing Configuration object.

I tried creating the SessionFactory in a WCF application which would only be restarted if some entity or mapping changes.

I have had problems with passing the SessionFactoryImpl (ISessionFactory) object from the service to my web application.

I tought I'd ask you guys if you have any idea how this can be achieved.

It's starting to be a PITA waiting like 25 seconds every time I make a change to a controller...

1

1 Answers

0
votes

There's no way, I'm afraid. Unlike Configuration, the session factory is not serializable.