EF Core 3.1 is the LTS version with three years of support. It’s also got significant performance improvements. Here’s what matters for production apps.
LINQ Query Improvements
EF Core 3.1 translates more LINQ patterns to SQL:
// Now translated to SQL
var results = context.Orders
.Select(o => new {
o.Id,
DayOfWeek = o.OrderDate.DayOfWeek,
Total = Math.Round(o.Amount, 2)
})
.ToList();
Breaking Change: Client Evaluation
EF Core 3.x throws exceptions for client-evaluated queries instead of silently evaluating. This catches performance problems early.
// This now FAILS if MyMethod can't be translated
var results = context.Users
.Where(u => MyMethod(u.Name)) // Exception!
.ToList();
// Explicit client evaluation
var results = context.Users
.AsEnumerable() // Intentional
.Where(u => MyMethod(u.Name))
.ToList();
Other Improvements
- Nullable reference type annotations
- Improved cosmos DB provider
- Better connection pooling
References
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.