Long story short,
IQueryable
is designed to postpone RUN process and firstly build the expression in conjunction with other IQueryable
expressions, and then interprets and runs the expression as a whole.
But ToList()
method (or a few sort of methods like that), are ment to run the expression instantly "as is".
Your first method (GetAllUrlsAsync
), will run imediately, because it is IQueryable
followed by ToListAsync()
method. hence it runs instantly (asynchronous), and returns a bunch of IEnumerable
s.
Meanwhile your second method (GetAllUrls
), won't get run. Instead, it returns an expression and CALLER of this method is responsible to run the expression.