c# 4.0 - What CurrentSessionContext to use with Tasks -
when using currentsessioncontext tasks, context should used?
i have been using threadstatic context, , warnings nhprof same session being used in multiple threads.
if using threadstatic should fine. should use different session per thread if used properly. typically use following use session context:
// open session if there not 1 opened yet. if (!currentsessioncontext.hasbind(sessionfactory)) { currentsessioncontext.bind(sessionfactory.opensession()); } var currentsession = sessionfactory.getcurrentsession();
Comments
Post a Comment