What exactly does IQueryable mean?

I'm not sure I understand what it is IQueryable.

I understand that he does not get all the entities and puts part of the constraint in memory, but executes it as part of the command that he sends to the database.

Please correct me if I am wrong and say why my repository functions return IQueryable, and not simple List?

+4
source share
2 answers

An IQueryableis not really a collection of objects, but describes how to get this collection. Data is never retrieved from a source until you evaluate it, turning it into IEnumerableor something similar.

IQueryable , .Where, . IEnumerable, , , .

+16

IQueryable IQueryable<T> - , LINQ; LINQ - , Entity Framework, - SQL, , , . LINQ LINQ -, , MongoDB JSON.

IQueryable , "" , , ToList(), ToArray(), Single(), SingleOrDefault(), First(), FirstOrDefault(), Count(), Any() .. , . Microsoft LINQ, , . , , IEnumerable<T> IQueryable<T>, AsQueryable().

+6

Source: https://habr.com/ru/post/1629810/


All Articles