EF Linq Error after change from dotnet Core 2.2.6 to 3.0.0

The reason is that implicit client evaluation has been disabled in EF Core 3.

What that means is that previously, your code didn’t execute the WHERE clause on the server. Instead, EF loaded all rows into memory and evaluated the expression in memory.

To fix this issue after the upgrade, first, you need to figure out what exactly EF can’t translate to SQL. My guess would be the call to GetValueOrDefault(), therefore try rewriting it like this:

.Where(x => x.BirthDate != null && x.BirthDate.Value.Month == DateTime.Now.Month)

Leave a Comment