score:2

You are accessing the DayOfWeek property from a DateTime reference in the query.

Entity Framework "doesn't know" how to translate that to SQL thus in the first piece of code you getting an exception.

And in the second piece it is working after you have fetch all of the data from database at the .ToList() call, and the .Where filtering is happening in the memory.

If you wish to implement that logic on the database side, you will have to write your own SQL statement.


Related Query

More Query from same tag