/// <summary> /// 回滚事务 /// </summary> public void Rollback() { current = null; if (this.db != null && !this.db.IsDisposed) { this.db.Rollback(); this.db = null; } }
/// <summary> /// 提交事务 /// </summary> public void Commit() { current = null; if (this.db != null && !this.db.IsDisposed) { this.db.Commit(); this.db = null; } }
/// <summary> /// 回滚事务 /// </summary> public void Rollback() { AfxTransaction.ClearCurrent(); if (null != this.transaction) { this.transaction.Rollback(); this.transaction.Dispose(); this.transaction = null; this.OnLog("-- Rollback"); this.Close(); } }
/// <summary> /// 提交事务 /// </summary> public void Commit() { if (null == this.transaction) { throw new InvalidOperationException("未开启事务,不能提交!"); } AfxTransaction.ClearCurrent(); this.transaction.Commit(); this.transaction.Dispose(); this.transaction = null; this.OnLog("-- Commit"); this.Close(); }
internal void Clear() { current = null; this.db = null; }
internal AfxTransaction(AfxDapper db) { this.db = db; current = this; }