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
Post a Comment