private void ContextEndRequest(object sender, EventArgs e)
        {
            var localFactory = SessionManager.Instance.SessionFactory;
            var session      = LazySessionContext.UnBind(localFactory);

            if (session != null)
            {
                EndSession(session);
            }
        }
        private void Error(object sender, EventArgs e)
        {
            var localFactory = SessionManager.Instance.SessionFactory;
            var session      = LazySessionContext.UnBind(localFactory);

            if (session != null)
            {
                if (session.Transaction != null && session.Transaction.IsActive)
                {
                    session.Transaction.Rollback();
                }
                session.Dispose();
            }
        }