public ITokenConsumeScope BeginScope() { if (_currentScope != null) { throw new NestedTransactionScopeExistsException(); } var scope = new TokenConsumeScope(this); _currentScope = scope; return scope; }
void INestedTokenScope.RollbackNested() { while (_currentScope.ConsumedCache.Count > 0) { var token = _currentScope.ConsumedCache.Dequeue(); _returnedTokens.Enqueue(token); } _currentScope = null; }
internal TokenConsumeScope(INestedTokenScope previousScope) { _previousScope = previousScope; _consumedCache = new Queue<Token>(); }