/// <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(); } }
/// <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; } } }
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(); }
public void Dispose() { _nhTransaction.Dispose(); }