Beispiel #1
0
        public bool MoveNext()
        {
            if (_state.ShouldPulseTransaction())
            {
                Debug.Assert(_context.Transaction.InnerTransaction.IsWriteTransaction == false, $"{nameof(PulsedTransactionEnumerator<T, TState>)} is meant to be used with read transactions only");

                _context.CloneReadTransaction();

                _innerEnumerator = _getEnumerator != null?_getEnumerator(_state) : _getEnumerable(_state).GetEnumerator();
            }

            if (Current is Document doc)
            {
                _context.Transaction.ForgetAbout(doc);
            }

            if (_innerEnumerator.MoveNext() == false)
            {
                return(false);
            }

            Current = _innerEnumerator.Current;

            _state.OnMoveNext(Current);

            return(true);
        }