EF Core 6 ships with .NET 6 and brings several performance and usability improvements. Here are the highlights.
1. Compiled Models
Pre-compile your model to avoid expensive startup reflection.
dotnet ef dbcontext optimize
2. Temporal Tables (SQL Server)
modelBuilder.Entity<Employee>()
.ToTable("Employees", b => b.IsTemporal());
3. Pre-Convention Model Configuration
Apply conventions like “all strings max 256” globally.
4. Migration Bundles
Package migrations as executables for CI/CD.
5. Raw SQL Queries
Execute raw SQL returning unmapped types.
Key Takeaways
- Use **Compiled Models** for apps with large schemas.
- Use **Temporal Tables** for audit trails without custom code.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.