Entity Framework Core 10
In this lesson, you will learn how Entity Framework Core 10 simplifies data access in modern .NET applications. We will cover bulk operations, JSON column mapping, complex types, and migration practices that help you build cleaner and more scalable data-driven applications.
← Back to Visual Studio 2026 Tutorial HomeWhat you will learn
- How EF Core 10 performs bulk updates and deletes efficiently
- How JSON columns can store structured data inside relational databases
- How complex types model value objects more cleanly
- How to manage schema changes with migrations
- Which EF Core practices improve maintainability and performance
Part 1: Bulk operations with ExecuteUpdate and ExecuteDelete
In earlier approaches, updating many records often required loading them into memory, modifying them one by one,
and then saving the changes. EF Core 10 makes this easier with bulk operations such as
ExecuteUpdateAsync and ExecuteDeleteAsync.
This allows you to update rows directly in the database without first materializing entities into memory. That can improve both performance and readability for certain tasks.
await context.Orders
.Where(o => o.Status == "Pending" && o.CreatedAt < cutoff)
.ExecuteUpdateAsync(s => s
.SetProperty(o => o.Status, "Expired")
.SetProperty(o => o.UpdatedAt, DateTime.UtcNow));
Part 2: Working with JSON columns
Modern applications often need to store flexible structured data without creating many extra tables. JSON columns provide a convenient option for this scenario in supported relational databases.
EF Core 10 allows you to map certain complex objects to JSON columns while still querying inside them using LINQ.
{
public int Id { get; set; }
public ShippingAddress Address { get; set; } // Stored as JSON
}
// Query into JSON data
context.Orders.Where(o => o.Address.Country == "US")
JSON columns are useful when a section of data belongs naturally to one entity but is still structured enough to benefit from typed access in code.
Part 3: Complex types and value objects
A complex type represents related values that belong together but do not have a separate identity of their own. This is useful for concepts such as money, addresses, dimensions, or contact details.
EF Core 10 improves support for this kind of modeling, making your domain classes cleaner and more expressive.
modelBuilder.Entity<Order>()
.ComplexProperty(o => o.Money, b => {
b.Property(m => m.Amount).HasPrecision(18, 4);
b.Property(m => m.Currency).HasMaxLength(3);
});
Part 4: Migration best practices
Migrations help you keep your database schema in sync with your EF Core models. They allow you to evolve the structure of your database in a controlled and repeatable way.
| Practice | Command |
|---|---|
| Add migration | dotnet ef migrations add MigrationName |
| Generate SQL script | dotnet ef migrations script |
| Apply to database | dotnet ef database update |
| Bundle for deployment | dotnet ef migrations bundle |
It is usually safer to review generated migration files rather than treating them as automatic magic. Small schema changes can have major effects in production systems.
When to use each feature
| Feature | Best used for |
|---|---|
| ExecuteUpdate / ExecuteDelete | Large set-based updates or deletes without loading entities |
| JSON columns | Flexible structured data stored inside one table row |
| Complex types | Value objects such as money, address, or settings |
| Migrations | Versioning and applying database schema changes safely |
A practical EF Core workflow
Best practices
- Keep your entities focused and easy to understand
- Do not overuse JSON columns when relational tables are more appropriate
- Review generated SQL for important or performance-sensitive queries
- Use migrations carefully and keep them organized
- Prefer bulk operations for large updates instead of looping through entities
- Model value objects with complex types where it improves clarity
Summary
In this lesson, you learned how Entity Framework Core 10 improves data access with bulk operations, JSON column support, complex types, and migration tooling. These features help you build cleaner, more expressive, and more scalable data-driven applications in Visual Studio 2026.
In the next lesson, you will continue by exploring unit testing and see how modern testing tools work together with Visual Studio.