Introduction

Entity Framework Core (EF Core) is one of the most popular Object-Relational Mapping (ORM) frameworks used in modern .NET applications. It helps developers work with databases using C# code instead of writing complex SQL queries.

With the release of EF Core 10, Microsoft has introduced several powerful improvements that enhance performance, developer productivity, and support for modern application architectures.

In this article, we will explore what’s new in EF Core 10 and provide a step-by-step migration guide from EF Core 8 in simple, practical language.

What is Entity Framework Core?

Entity Framework Core is a lightweight, extensible, and cross-platform ORM that allows developers to:

It supports multiple databases like SQL Server, PostgreSQL, MySQL, and SQLite.

What’s New in EF Core 10?

1. Improved Query Performance

EF Core 10 introduces better query optimization, especially for complex joins and nested queries.

Example:

var users = await context.Users
    .Where(u => u.IsActive)
    .ToListAsync();

This query now executes more efficiently compared to previous versions.

2. Enhanced JSON Column Support

EF Core 10 improves support for JSON columns in relational databases.

Example:

public class Product
{
    public int Id { get; set; }
    public string Name { get; set; }
    public ProductDetails Details { get; set; }
}

This makes it easier to work with semi-structured data.

3. Better Bulk Updates and Deletes

EF Core 10 improves batch operations.

Example:

await context.Users
    .Where(u => !u.IsActive)
    .ExecuteUpdateAsync(s => s.SetProperty(u => u.IsDeleted, true));

4. Improved Migrations Experience

5. Interceptors and Logging Enhancements

6. Better Support for Cloud-Native Apps

EF Core 10 is optimized for microservices and cloud environments:

Why Upgrade from EF Core 8?

Upgrading to EF Core 10 provides:

Step-by-Step Migration from EF Core 8 to EF Core 10

Step 1: Backup Your Project

Before starting migration:

This ensures safety in case of issues.

Step 2: Update .NET SDK

Ensure you are using the latest .NET version compatible with EF Core 10.

dotnet --version

Update if needed.

Step 3: Update NuGet Packages

Update EF Core packages:

dotnet add package Microsoft.EntityFrameworkCore --version 10.0.0

dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 10.0.0

Also update related packages like:

Step 4: Update DbContext Configuration

Check your DbContext setup.

Example:

builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(connectionString));

Ensure compatibility with new features.

Step 5: Review Breaking Changes

Check for:

Fix them accordingly.

Step 6: Update Migrations

Run:

dotnet ef migrations add UpgradeToEfCore10

dotnet ef database update

This updates your database schema.

Step 7: Test Your Application

Step 8: Optimize Using New Features

After migration:

Common Issues During Migration

Solution:

Best Practices

Real-World Example

In an e-commerce application:

Conclusion

Entity Framework Core 10 brings powerful improvements in performance, flexibility, and developer experience. Migrating from EF Core 8 is straightforward if done step by step.

By upgrading, you can build faster, scalable, and modern data-driven applications using the latest capabilities of EF Core.

Start migrating today and take advantage of the improved performance and features in EF Core 10.