Maybe it's simple question, but does AsQueryable()
have some performance loss?
Generally speaking we are working with RavenDB and we have existing code like this
protected override IQueryable<T> QueryableIndexRawQuery(string rawQuery, int skip = 0, int take = 128, string indexName = null)
{
var defaultIndexName = !string.IsNullOrWhiteSpace(indexName) ? indexName : string.Format("{0}{1}", typeof(T).Name, IndexPreffix);
return this.Session.Advanced.DocumentStore.DatabaseCommands.GetIndex(defaultIndexName) != null
? this.Session.Advanced.LuceneQuery<T>(defaultIndexName).Statistics(out this.Statistics).Skip(skip).Take(take).Where(rawQuery).AsQueryable()
: this.Session.Advanced.LuceneQuery<T>().Statistics(out this.Statistics).Skip(skip).Take(take).Where(rawQuery).AsQueryable();
}
So Where clause return us IDocumentQuery
then we try to represent it AsQueryable()
this.Session.Advanced.LuceneQuery<T>(defaultIndexName).Statistics(out this.Statistics).Skip(skip).Take(take).Where(rawQuery)
The question what AsQueryable()
eventually does internally? How does it convert it?
Answers with in-memory collection examples like List<>
will be really useful as well.
Like this:
var list = new List<string>() { "1", "2", "3" };
list.AsQueryable();