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)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…