Ejemplo n.º 1
0
        public IEnumerable <TKey> GetKeyEnumerator()
        {
            //execute empty transaction, to apply any comitted but unapplied transactions
            this.Session.Transaction(() => { });
            lock (this.Session.SyncLock)
            {
                foreach (var range in this.Ranges)
                {
                    var index = new RecordIndex <TKey>(
                        this.Session,
                        this.RecordManager,
                        this.IndexName,
                        this.Session.SerializerResolver.SerializerFor <Node <TKey> >()
                        );
                    var keyEnumerator = new KeysEnumerator <T, TKey>(
                        this.Collection,
                        this.Session,
                        index,
                        this.IsDescending);

                    keyEnumerator.SetRange(range);
                    foreach (var key in keyEnumerator)
                    {
                        yield return(key);
                    }
                }
            }
        }
        public IEnumerable <TKey> GetKeyEnumerator()
        {
            lock (this.Session.SyncLock)
            {
                var index = new RecordIndex <TKey>(
                    this.Session,
                    this.RecordManager,
                    this.IndexName,
                    this.Session.SerializerResolver.SerializerFor <Node <TKey> >()
                    );
                var keyEnumerator = new KeysEnumerator <T, TKey>(
                    this.Collection,
                    this.Session,
                    index,
                    this.IsDescending);

                keyEnumerator.SetRange(this.Range);

                return(keyEnumerator);
            }
        }