Ejemplo n.º 1
0
        public void RollbackTransactionOn(string sessionFactoryConfigPath)
        {
            ITransaction transaction = (ITransaction)ContextTransactions[sessionFactoryConfigPath];

            try {
                if (HasOpenTransactionOn(sessionFactoryConfigPath))
                {
                    transaction.Rollback();
                }

                ContextTransactions.Remove(sessionFactoryConfigPath);
            }
            finally {
                CloseSessionOn(sessionFactoryConfigPath);
            }
        }
Ejemplo n.º 2
0
        public void CommitTransactionOn(string sessionFactoryConfigPath)
        {
            ITransaction transaction = (ITransaction)ContextTransactions[sessionFactoryConfigPath];

            try {
                if (HasOpenTransactionOn(sessionFactoryConfigPath))
                {
                    transaction.Commit();
                    ContextTransactions.Remove(sessionFactoryConfigPath);
                }
            }
            catch (HibernateException) {
                RollbackTransactionOn(sessionFactoryConfigPath);
                throw;
            }
        }
        public void RollbackTransactionOn(string contextName)
        {
            ITransaction transaction = (ITransaction)ContextTransactions[contextName];

            try
            {
                if (HasOpenTransactionOn(contextName))
                {
                    transaction.Rollback();
                }

                ContextTransactions.Remove(contextName);
            }
            finally
            {
                CloseSessionOn(contextName);
            }
        }
        public void CommitTransactionOn(string contextName)
        {
            ITransaction transaction = (ITransaction)ContextTransactions[contextName];

            try
            {
                if (HasOpenTransactionOn(contextName))
                {
                    transaction.Commit();
                    ContextTransactions.Remove(contextName);
                }
            }
            catch (HibernateException)
            {
                RollbackTransactionOn(contextName);
                throw;
            }
        }
        public void RollbackTransactionOn(string sessionFactoryName)
        {
            ITransaction transaction = (ITransaction)ContextTransactions[sessionFactoryName];

            try
            {
                if (HasOpenTransactionOn(sessionFactoryName))
                {
                    var session = (ISession)ContextSessions[sessionFactoryName];
                    session.Flush();
                    transaction.Rollback();
                }

                ContextTransactions.Remove(sessionFactoryName);
            }
            finally
            {
                //CloseSessionOn(sessionFactoryName);
            }
        }