This is called in my service. Now I have asked myself when should I do the .ToList() on the query to materialize the entities?
Do I have to do it at all? Because my application layer will anyway convert the entities to a json array and finally then the enumerator must be enumerated...
Should I follow this thinking? Or is it better to only return a materialized collection to my application layer?
IEnumerable<BrowseSchoolyearDTO> ISchoolyearService.GetAll(int userId)
{
return _context.Schoolyears
.Where(s => s.UserId == userId)
.Select(s => s.ToBrowseSchoolyearDto())
.ToList();
}