/// <summary> /// Returns an typed enumerator that iterates through the collection in the order specified by the index. The typed enumerator uses /// the object serializer of <typeparamref name="T"/> to deserialize objects by default. /// </summary> /// <param name="LockType"> /// If locked access to the file is requested, and of what type. /// /// If unlocked access is desired, any change to the database will invalidate the enumerator, and further access to the /// enumerator will cause an <see cref="InvalidOperationException"/> to be thrown. /// /// If read locked access is desired, the database cannot be updated, until the enumerator has been disposed. /// If write locked access is desired, the database cannot be accessed at all, until the enumerator has been disposed. /// /// Make sure to call the <see cref="ObjectBTreeFileEnumerator{T}.Dispose"/> method when done with the enumerator, to release /// the database lock after use. /// </param> /// <param name="LockParent">If parent file is to be locked as well.</param> /// <returns>An enumerator that can be used to iterate through the collection.</returns> public async Task <IndexBTreeFileEnumerator <T> > GetTypedEnumerator <T>(LockType LockType, bool LockParent) { IndexBTreeFileEnumerator <T> e = await IndexBTreeFileEnumerator <T> .Create(this, this.recordHandler); if (LockType != LockType.None) { await e.Lock(LockType, LockParent); } return(e); }
/// <summary> /// Returns an untyped enumerator that iterates through the collection in the order specified by the index. /// /// For a typed enumerator, call the <see cref="GetTypedEnumerator{T}(LockType, bool)"/> method. /// </summary> /// <returns>An enumerator that can be used to iterate through the collection.</returns> public async Task <IEnumerator <object> > GetEnumeratorAsync() { return(await IndexBTreeFileEnumerator <object> .Create(this, this.recordHandler)); }