private void ThrowIfDisposed(VoronState state) { if (state == null) { ThrowDisposed(); return; // never hit } if (state.Transaction.LowLevelTransaction.IsDisposed) { ThrowTransactionDisposed(); } if (_cts.IsCancellationRequested) { ThrowCancelled(); } }
public IDisposable SetTransaction(Transaction tx, out IState state) { if (tx == null) { throw new ArgumentNullException(nameof(tx)); } var currentValue = new VoronState(tx); state = StateHolder.Current.Value = currentValue; return(new DisposableAction(() => { currentValue.Transaction = null; StateHolder.Current.Value = null; })); }