protected virtual void Dispose(bool disposing) { // If it's working, give it a few seconds to see if can finish for (int i = 1; IsWorking() && i <= 300; ++i) { Thread.Sleep(10); } if (!IsWorking()) { if (CurrentTransaction != null) { CurrentTransaction.Dispose(); CurrentTransaction = null; } if (CurrentConnection != null) { CurrentConnection.Dispose(); CurrentConnection = null; } } else { //#if DEBUG // if (System.Diagnostics.Debugger.IsAttached) // { // System.Diagnostics.Debugger.Break(); // } //#endif CurrentTransaction = null; CurrentConnection = null; } }
public void Dispose() { if (Interlocked.Exchange(ref disposeSignaled, 1) != 0) { return; } try { if (CurrentTransaction != null) { CurrentTransaction.Commit(); } } finally { if (CurrentTransaction != null) { CurrentTransaction.Dispose(); scopedTransaction = null; } if (CurrentConnection != null) { CurrentConnection.Dispose(); scopedConnection = null; } if (Disposed != null) { Disposed(this, EventArgs.Empty); } } isDisposed = true; }
public void Rollback() { CurrentTransaction?.Rollback(); CurrentTransaction?.Dispose(); if (CurrentConnection?.State == ConnectionState.Open) { CurrentConnection.Close(); } CurrentConnection?.Dispose(); }
public void Commit() { CurrentTransaction?.Commit(); CurrentTransaction?.Dispose(); if (CurrentConnection?.State == ConnectionState.Open) { CurrentConnection.Close(); } CurrentConnection?.Dispose(); }
/// <summary> /// 执行与释放或重置非托管资源关联的应用程序定义的任务。 /// </summary> public void Dispose() { if (CurrentTransaction != null) { CurrentTransaction.Dispose(); CurrentTransaction = null; } if (CurrentConnection != null) { CurrentConnection.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (!IsWorking()) { if (CurrentTransaction != null) { CurrentTransaction.Dispose(); CurrentTransaction = null; } if (CurrentConnection != null) { CurrentConnection.Dispose(); CurrentConnection = null; } } }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (CurrentTransaction != null) { CurrentTransaction.Dispose(); CurrentTransaction = null; } if (CurrentConnection != null) { CurrentConnection.Dispose(); CurrentConnection = null; } _disposedValue = true; } }
protected virtual void Dispose(bool disposing) { if (!IsWorking()) { if (CurrentTransaction != null) { CurrentTransaction.Dispose(); CurrentTransaction = null; } if (CurrentConnection != null) { CurrentConnection.Dispose(); CurrentConnection = null; } } //CEFDebug.WriteInfo($"Dispose connection: " + _id); }