Lesson 6 of 40 Data Access Intermediate 55 min

Entity Framework Core 10

Master EF Core 10's new bulk operations, JSON column support, complex type improvements, and the overhauled migration system.

Part 1: Bulk Operations (ExecuteUpdate/Delete)

// Update without loading entities into memory
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: JSON Columns

Store complex objects as JSON in relational databases with full LINQ querying:
public class Order
{
  public int Id { get; set; }
  public ShippingAddress Address { get; set; } // Stored as JSON
}

// LINQ query into JSON column:
context.Orders.Where(o => o.Address.Country == "US")

Part 3: Complex Types (Value Objects)

EF Core 10 supports complex types — value objects without identity:
// Configuration
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: Migrations Best Practices

PracticeCommand
Add migrationdotnet ef migrations add MigrationName
Generate SQL scriptdotnet ef migrations script
Apply to productiondotnet ef database update --connection "..."
Bundle for CI/CDdotnet ef migrations bundle
VISUAL STUDIO 2026 MADE EASY
Recommended Book

VISUAL STUDIO 2026 MADE EASY

Build real applications with C#, VB.NET, Python, JavaScript, C++, and .NET 10. A practical companion for mastering Visual Studio 2026 step by step.