I started using NHibernateSessionPerConversationModule.cs HttpModule
(http://www.summerofnhibernate.com/ ) which creates a session per
conversation ( and everytime there is a page request for some reason
the Application_BeginRequest gets fired twice. And it ends up throwing
the follwoing messages.

1) Object reference not set to an instance of an object.

When I dig deeper here is what i see in the follwoing error messages

   base {System.NotSupportedException} = {"This operation requires IIS
integrated pipeline mode."}

   CurrentNotification = 'HttpContext.Current.CurrentNotification'
threw an exception of type 'System.PlatformNotSupportedException'

Iam using Visual studio 2008 on my windows 7 laptop and IIS server
( Version 7.5.7600.16358 ) . Am not sure if I have to change any
settings in the integrated webserver of VS 2008.

Here is the code.

    private void Application_BeginRequest(object sender, EventArgs e)
        {
            ISession currentSession =
(ISession)HttpContext.Current.Session[NHIBERNATE_CURRENT_SESSION_KEY];
            if (currentSession == null)
            {
                currentSession = StaticSessionManager.OpenSession();
                currentSession.FlushMode = FlushMode.Never;
            }
            CurrentSessionContext.Bind(currentSession);
            currentSession.BeginTransaction();
        }

        private void Application_EndRequest(object sender, EventArgs
e)
        {
            ISession session =
CurrentSessionContext.Unbind(StaticSessionManager.SessionFactory);

            if
(HttpContext.Current.Items[NHIBERNATE_CONVERSATION_END_FLAG_KEY] !=
null)
            {
                session.Flush();
                session.Transaction.Commit();
                session.Close();
 
HttpContext.Current.Session[NHIBERNATE_CURRENT_SESSION_KEY] = null;
            }
            else
            {
                session.Transaction.Commit();
 
HttpContext.Current.Session[NHIBERNATE_CURRENT_SESSION_KEY] = session;
            }

        }

-- 
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