Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Disposes off managed and un-managed resources used by the <see cref="NHTransaction"/> instnace.
 /// </summary>
 /// <param name="disposing"></param>
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (!_disposed)
         {
             _transaction.Dispose();
             _disposed = true;
         }
     }
 }
Ejemplo n.º 3
0
        protected override void DisposeCore()
        {
            transientEntities.Clear();
            if (transaction != null)
            {
                if (transaction.IsActive)
                {
                    transaction.Rollback();
                }

                transaction.Dispose();
                transaction = null;
            }

            if (session != null)
            {
                if (session.IsOpen)
                {
                    session.Close();
                }

                session.Dispose();
            }
        }
 public virtual void Dispose()
 {
     adapted.Dispose();
 }
Ejemplo n.º 5
0
 public void Dispose()
 {
     _nhTransaction.Dispose();
 }