public void Dispose()
 {
     if (NHibernator.SessionExist(sessionFactoryName))
     {
         ISession session = NHibernator.GetSession(sessionFactoryName);
         if ((transaction.WasCommitted == false) && (transaction.WasRolledBack == false))
         {
             NHibernator.Rollback(sessionFactoryName);
         }
     }
 }
 public void Commit()
 {
     try
     {
         NHibernator.Commit(sessionFactoryName);
     }
     catch
     {
         NHibernator.Rollback(sessionFactoryName);
         throw;
     }
 }
Exemple #3
0
        private void context_EndRequest(object sender, EventArgs e)
        {
            Dictionary <string, ISession> sessions = NHibernator.SessionStorage.Sessions;

            if (sessions != null)
            {
                List <string> sessionsToClose = new List <string>();

                foreach (KeyValuePair <string, ISession> session in sessions)
                {
                    sessionsToClose.Add(session.Key);
                }

                foreach (string sessionKey in sessionsToClose)
                {
                    NHibernator.CloseSession(sessionKey);
                }
            }
        }
 public void RollBack()
 {
     NHibernator.Rollback(sessionFactoryName);
 }
 public NHibernatorTransaction(string sessionFactoryName)
 {
     this.sessionFactoryName = sessionFactoryName;
     NHibernator.BeginTransaction(sessionFactoryName);
     transaction = NHibernator.GetSession(sessionFactoryName).Transaction;
 }