Hi,
can anyone tell me which sessioncontext should be used in a Wcf
environment.
Currently I have a web application calling a WCF service, hosted in
IIS. The WCF service does all the work and uses NHibernate.

I am using sessioncontext in a static class to manage nhibernate
session like this:

        public static ISession GetCurrentSession()
        {
            if (!CurrentSessionContext.HasBind(SessionFactory))
            {
                CurrentSessionContext.Bind(SessionFactory.OpenSession
());
            }
            return SessionFactory.GetCurrentSession();
        }

and in the config I have:
<property name="current_session_context_class">call</property>

When multiple users access the system, exceptions start being thrown,
such as "Session is closed". Which gives me the impression the session
is being shared, and isnt unique to each request.

Currently, for each WCF function, Im calling:
NhibernateHelper.BeginTransaction();
// Do work
NHibernateHelper.CommitTransaction();
NHibernateHelper.DisposeSession();

There's something Im doing wrong, but Im racking my brains trying to
find the solution.

Any response gratefully appreciated.


Andy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to