As I understood, we should use IQueryable to fetch list of data from database server.
Especially when we filter the data based on some condition.
For example below the filter will be done on SQL Server instead of the application to reduce network traffic
var users = _dbContext.users
.Where(x => x.age > 18)
.AsQueryable();
But if we did it like below the SQL server will return the whole users table and the where will be executed from the memory list
var users = _dbContext.users
.Where(x => x.age > 18)
.ToList();
But my question is what if we actually want the whole table? so does using
var users = _dbContext.users
.AsQueryable();
has any advantages over using
var users = _dbContext.users
.Where(x => x.age > 18)
.ToList();