Exemple #1
0
        /// <summary>
        /// Occurs after the action method is invoked.
        /// </summary>
        /// <param name="actionExecutedContext">The action executed context.</param>
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            string effectiveFactoryKey = this.GetEffectiveFactoryKey();

            global::NHibernate.ITransaction currentTransaction = NHibernateSession.CurrentFor(effectiveFactoryKey).Transaction;

            try
            {
                if (currentTransaction.IsActive)
                {
                    if (actionExecutedContext.Exception != null)
                    {
                        currentTransaction.Rollback();
                    }
                    else
                    {
                        currentTransaction.Commit();
                    }
                }
            }
            finally
            {
                currentTransaction.Dispose();
            }
        }
Exemple #2
0
        /// <summary>
        /// Commits the changes made to the data store.
        /// </summary>
        public void Commit()
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("NHTransaction", "Cannot commit a disposed transaction.");
            }

            _transaction.Commit();
            if (TransactionCommitted != null)
            {
                TransactionCommitted(this, EventArgs.Empty);
            }
        }
Exemple #3
0
 public virtual void Commit()
 {
     EnsureTransaction();
     try
     {
         transientEntities.Each(e => session.Save(e));
         transaction.Commit();
         transientEntities.Clear();
     }
     catch
     {
         transaction.Rollback();
         transientEntities.Clear();
         throw;
     }
 }
Exemple #4
0
        public void Commit()
        {
            try
            {
                _nhTransaction.Commit();
            }
            catch (global::NHibernate.StaleObjectStateException ex)
            {
                _nhTransaction.Rollback();
                throw new ConflictException("During confirm the change, conflict has been detected.", ex);
            }
            catch
            {
                _nhTransaction.Rollback();
                _session.Clear();

                throw;
            }
        }
 public void Commit()
 {
     using (global::NHibernate.ITransaction transaction = Session.BeginTransaction())
     {
         try
         {
             transaction.Commit();
         }
         catch (StaleObjectStateException ex)
         {
             transaction.Rollback();
             throw new ConflictException("In the final, the change was detected by competition.", ex);
         }
         catch
         {
             transaction.Rollback();
             throw;
         }
     }
 }
 public virtual void Commit()
 {
     adapted.Commit();
 }
Exemple #7
0
 public void Commit()
 {
     _transaction.Commit();
 }