Behnam Esmaili Behnam Esmaili - 2 months ago 7x
C# Question

Is Orchard contentManager `List()` identical to Linq Tolist()?

The question is, when I call

in a
(to Sql) query it fetches all the records from db and brings them into memory.and I wonder if
method of orchard ContentManager has same effect ?

Thanks in advance.


Yes. List() returns:

_query.Slice(0, 0).AsPart<T>()

Slice(0, 0) returns the whole result set as a read-only collection, and has the effect of executing the query and bringing the results into memory. AsPart<T>() presents the list of content items as a list of parts of type T.