예제 #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();
            }
        }
예제 #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;
         }
     }
 }
예제 #3
0
파일: Database.cs 프로젝트: kingsor/shrinkr
        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();
 }
예제 #5
0
 public void Dispose()
 {
     _nhTransaction.Dispose();
 }