public async Task <IReadOnlyCollection <Course> > GetCoursesAsync() { var results = await _context.AsQueryable() .ToListAsync(); return(results.AsReadOnly()); }
/* * this method let’s us to get whole non-materialized collection and * perform some operations later * (it’s slower than other methods because adds extra abstraction layer) */ public IQueryable <T> AsQueryable() { return(_collection.AsQueryable()); }