/// <summary> /// Execute query and return resultset as IEnumerable of T. If T is a ValueType or String, return values only (not documents) /// </summary> public IEnumerable <T> ToEnumerable() { if (_isSimpleType) { return(this.ToDocuments() .Select(x => x[x.Keys.First()]) .Select(x => (T)_mapper.Deserialize(typeof(T), x))); } else { return(this.ToDocuments() .Select(x => (T)_mapper.Deserialize(typeof(T), x))); } }
/// <summary> /// Execute query and return resultset as IEnumerable of T. If T is a ValueType or String, return values only (not documents) /// </summary> public async IAsyncEnumerable <T> ToAsyncEnumerable() { if (_isSimpleType) { await foreach (var doc in this.ToDocumentsAsync()) { var key = doc.Keys.First(); yield return((T)_mapper.Deserialize(typeof(T), key)); } } else { await foreach (var doc in this.ToDocumentsAsync()) { var key = doc.Keys.First(); yield return((T)_mapper.Deserialize(typeof(T), doc)); } } }