How to configure NHibernate with SignalR -


i want configure nhibernate once , reuse session factory open different sessions manipulate database, hubs considered transient objects , loose object state when client initializing request hub. way far have read make objects static in order reuse it.

is there other way of achieving without making objects static ?

myconfiguration = new configuration();             myconfiguration.configure();             mysessionfactory = myconfiguration.buildsessionfactory();             mysession = mysessionfactory.opensession(); 

thank in advance :)

there nothing wrong having configuration , sessionfactory objects stored in static fields. sessions should not shared.

an alternative use di container , register them singletons.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -