/// <summary> /// Commits this transaction. /// </summary> public void Commit() { if (DbTransaction != null) { try { DbTransaction.Commit(); if (EntityTracker != null) { EntityTracker.AfterCompletion(true); } } finally { DbTransaction = null; } } }
/// <summary> /// Roll back this transaction. /// </summary> public void Rollback() { if (DbTransaction != null) { try { DbTransaction.Rollback(); if (EntityTracker != null) { EntityTracker.AfterCompletion(false); } } finally { DbTransaction = null; } } }
/// <summary> /// Disposes of this Transaction instance and rolls back the active transaction if it is still active. /// </summary> public void Dispose() { if (DbTransaction != null) { try { DbTransaction.Rollback(); Log.Error("Transaction: Transaction disposed without commit."); if (EntityTracker != null) { EntityTracker.AfterCompletion(false); } } finally { DbTransaction = null; } } }