public virtual void Add <T>(T entity) where T : class, IEntity { try { EnsureTransaction(); transientEntities.Add(entity); } catch { transaction.Rollback(); transientEntities.Clear(); throw; } }
/// <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(); } }
public virtual void Add <TEntity>(TEntity entity) where TEntity : class, IEntity { Check.Argument.IsNotNull(entity, "entity"); try { EnsureTransaction(); transientEntities.Add(entity); } catch { transaction.Rollback(); transientEntities.Clear(); throw; } }
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; } } }
/// <summary> /// Rollsback any changes made. /// </summary> public void Rollback() { if (_disposed) { throw new ObjectDisposedException("NHTransaction", "Cannot rollback a disposed transaction."); } _transaction.Rollback(); if (TransactionRolledback != null) { TransactionRolledback(this, EventArgs.Empty); } }
public virtual void Rollback() { adapted.Rollback(); }
public void Rollback() { _transaction.Rollback(); }