What's New in ASP.NET Core 11 and EF Core 11
ASP.NET Core builds your web APIs and EF Core talks to your database. Both got a new version with .NET 11. Here's what changed, and which parts you'll actually use.
When .NET gets a new version, its two most popular frameworks move with it: ASP.NET Core 11 for web apps and APIs, and EF Core 11 for databases. Their release notes run to dozens of pages, covering everything from TLS handshakes to vector search.
This lesson picks the changes that matter for the kind of apps you've built in this course: a REST API with validation, OpenAPI documentation and a SQL database behind it. Each change comes with an example from Microsoft's documentation.
In this lesson, you'll learn async validation, union types in API bodies, OpenAPI 3.2 by default, Zstandard compression and the new MCP server template in ASP.NET Core 11, then FULL JOIN, MaxBy/MinBy and one-step migrations in EF Core 11, plus the upgrade notes to watch.
What Is It?
The Simple Explanation
ASP.NET Core 11 and EF Core 11 are the versions of these frameworks that go with .NET 11. Your existing API and database code keeps working, and the new versions add features that remove common workarounds.
The Technical Definition
ASP.NET Core 11 ships in the .NET 11 shared framework. EF Core 11 ships as NuGet packages with version 11.x; it requires the .NET 11 SDK to build and the .NET 11 runtime to run, and won't run on earlier .NET versions or .NET Framework. Highlights include asynchronous validation through Microsoft.Extensions.Validation, System.Text.Json support for C# 15 unions in request and response bodies, OpenAPI documents generated as OpenAPI 3.2 by default, Zstandard response compression and request decompression, a bundled mcpserver template, LINQ translation of FullJoin and MaxBy/MinBy, and dotnet ef database update --add.
ASP.NET Core 11
- Async validation attributes and objects
- Union types in JSON request and response bodies
- OpenAPI 3.2 documents by default
- Zstandard (zstd) compression
- dotnet new mcpserver template
EF Core 11
- FullJoin becomes SQL FULL JOIN
- MaxByAsync / MinByAsync translated to SQL
- Create and apply a migration in one command
- Complex types and JSON columns with TPT/TPC inheritance
- Cleaner SQL (no-op CASTs removed)
Why Does It Exist?
The Problem — Real Apps Kept Hitting the Same Walls
Validation that needed the database ("is this email already registered?") couldn't run asynchronously, so it ended up in endpoint code instead of in validation. LINQ had no full outer join for EF Core to translate. Creating and applying a migration took two commands and a rebuild, which is awkward in containers.
The Solution — Close Those Gaps
Each feature in this lesson removes one of those walls, so code goes back where it belongs: validation rules in validators, queries in LINQ, and migrations in one step.
Big Picture
How It Works
- System.Text.Json reads it, including any C# 15 union types in the model.
- Attributes such as [Required] run as before, and async validators can now query a database or another service without blocking a thread.
- Only valid requests reach your code. EF Core 11 turns your LINQ, now including FullJoin and MaxByAsync, into SQL.
- Serialized as JSON and, if the client supports it, compressed with Zstandard. The OpenAPI 3.2 document describes all of this for client generators.
ASP.NET Core 11: Async Validation
In lesson 259 you validated requests with attributes such as [Required]. Some rules need to ask a database or another service, which is slow and should be asynchronous. .NET 11 adds AsyncValidationAttribute for that:
using System.ComponentModel.DataAnnotations;
using Microsoft.Extensions.DependencyInjection;
public sealed class UniqueEmailAttribute : AsyncValidationAttribute
{
// This attribute validates asynchronously only.
protected override ValidationResult? IsValid(object? value, ValidationContext context) =>
throw new InvalidOperationException("Validate this attribute with IsValidAsync.");
protected override async Task<ValidationResult?> IsValidAsync(
object? value, ValidationContext context, CancellationToken cancellationToken)
{
var users = context.GetRequiredService<IUserService>();
if (value is string email && await users.EmailExistsAsync(email, cancellationToken))
{
return new ValidationResult("That email is already registered.");
}
return ValidationResult.Success;
}
}Put [UniqueEmail] on a property like any other validation attribute. For rules that look at several properties at once, a class can implement IAsyncValidatableObject and return results as an IAsyncEnumerable<ValidationResult>. In minimal APIs, register validation once, and the framework validates each request before your endpoint runs:
builder.Services.AddValidation();
app.MapPost("/users", (CreateUserRequest request) => Results.Ok(request));ASP.NET Core 11: Unions in APIs and OpenAPI 3.2
The C# 15 union types from lesson 348 work anywhere ASP.NET Core uses System.Text.Json, including request and response bodies:
public union UnionIntString(int, string);
app.MapGet("/value", () => new UnionIntString(42)); // response body: 42In the generated OpenAPI document, an endpoint that returns a union is described with an anyOf schema listing each case type. Unions can't be bound from route values, query strings, headers or form fields.
Generated OpenAPI documents (see lesson 133) now target OpenAPI 3.2 by default. If a tool you use doesn't support 3.2 yet, pick the older version explicitly:
builder.Services.AddOpenApi(options =>
{
options.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi3_1;
});ASP.NET Core 11: Zstandard and the MCP Server Template
The response-compression and request-decompression middleware now support Zstandard (zstd), and it's enabled by default when you add them:
builder.Services.AddResponseCompression();
builder.Services.AddRequestDecompression();
builder.Services.Configure<ZstandardCompressionProviderOptions>(options =>
{
options.CompressionOptions = new ZstandardCompressionOptions
{
Quality = 6 // 1-22: higher compresses better but is slower
};
});The Model Context Protocol (MCP) is an open standard that AI assistants (in Visual Studio, VS Code, GitHub Copilot and elsewhere) use to call external tools. The mcpserver template, which used to need a separate install, now ships with the .NET SDK and creates a working C# MCP server with a sample tool:
dotnet new mcpserver -o MyMcpServerEF Core 11: FULL JOIN and MaxBy
LINQ's new FullJoin (see lesson 354) is translated by EF Core 11 into SQL FULL JOIN, which keeps rows from both tables:
var results = await context.Customers
.FullJoin(
context.Orders,
c => c.Id,
o => o.CustomerId,
(c, o) => new { Customer = c, Order = o })
.ToListAsync();SELECT [c].[Id], [c].[Name], [o].[Id], [o].[CustomerId], [o].[OrderDate]
FROM [Customers] AS [c]
FULL JOIN [Orders] AS [o] ON [c].[Id] = [o].[CustomerId]MaxByAsync and MinByAsync are translated too. They return the row with the biggest or smallest value, not just the value:
var blogWithMostPosts = await context.Blogs.MaxByAsync(b => b.Posts.Count());EF Core 11: Create and Apply a Migration in One Step
In lesson 144 you created a migration with dotnet ef migrations add and applied it with dotnet ef database update. EF Core 11 can do both at once with the new --add option. It compiles the migration on the fly, which helps in containers and .NET Aspire setups where rebuilding isn't possible, and still saves the migration files to disk for source control:
dotnet ef database update InitialCreate --addSimple Example
A minimal API that combines three of the new pieces: async validation on the request, a union in the response, and the OpenAPI document describing both.
using System.ComponentModel.DataAnnotations;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenApi(); // OpenAPI 3.2 by default in .NET 11
builder.Services.AddValidation(); // runs sync and async validators
builder.Services.AddSingleton<IUserService, UserService>();
var app = builder.Build();
app.MapOpenApi();
app.MapPost("/users", (CreateUserRequest request) =>
Results.Ok(new UserCreated(request.Email)));
app.Run();
public class CreateUserRequest
{
[Required, EmailAddress, UniqueEmail]
public string Email { get; set; } = "";
}
public record UserCreated(string Email);Code → Meaning → Result: A POST with an email that already exists is rejected by the async [UniqueEmail] validator before the endpoint runs, with no thread blocked while the database is checked. Valid requests reach the endpoint. /openapi/v1.json serves an OpenAPI 3.2 description of the endpoint. (IUserService and UserService are your own types, as in the validator above.)
Real-World Example
A reporting page shows every customer and every order, including customers who never ordered and orders whose customer was deleted, for a data-quality check. Before EF Core 11 that took two queries and a merge in memory. Now it's one query, and the database does the work:
var report = await context.Customers
.FullJoin(context.Orders, c => c.Id, o => o.CustomerId,
(c, o) => new
{
Customer = c == null ? "(deleted customer)" : c.Name,
OrderId = o == null ? (int?)null : o.Id,
})
.ToListAsync();Analogy
ASP.NET Core is the restaurant front of house: taking orders (requests), checking them (validation), and serving food (responses). EF Core is the kitchen's link to the pantry (the database).
Version 11 is a refit: the host can now phone the pantry while checking an order without making everyone wait (async validation), the menu is printed in a newer format (OpenAPI 3.2), the kitchen gained a combined "who ordered and who didn't" report (FULL JOIN), and stocking a new shelf takes one trip instead of two (one-step migrations).
Under the Hood
- Validators run concurrently where possible. Async attributes on the same property start together and collection items validate in parallel, while the usual order (member, then type, then IValidatableObject) is preserved.
- **Unions in OpenAPI don't use a $type field.** Unlike polymorphic types, each union case reuses its own schema component, so tools such as Swashbuckle and NSwag see a clean anyOf.
- EF Core 11 needs .NET 11. EF Core 11 packages require the .NET 11 runtime; projects that must stay on .NET 10 should stay on EF Core 10.
- Upgrade notes. EF Core 11 moves to Microsoft.Data.SqlClient 7.0, the default SQL Server compatibility level is now 160, and EF Core now throws by default when it finds no migrations to apply. Check the EF Core 11 breaking-changes page when you upgrade.
Common Confusion
1. "Async validation means I must rewrite my existing attributes" — no
[Required], [Range] and your existing synchronous attributes keep working. Use AsyncValidationAttribute only for rules that need to wait on I/O.
2. "OpenAPI 3.2 breaks my existing clients" — usually not
Documents generate as before; only the version they declare changes. If a specific tool can't read 3.2 yet, set OpenApiVersion to OpenApi3_1 as shown above.
3. "FullJoin runs in memory" — not with EF Core 11
Against a database, EF Core 11 translates FullJoin into a SQL FULL JOIN, so only the joined rows come back over the network.
Common Mistakes
Mistake 1 — Leaving the synchronous IsValid empty
The mistake: Deriving from AsyncValidationAttribute and returning ValidationResult.Success from the synchronous IsValid. Code that validates synchronously would then skip your rule silently.
The fix: Throw from the synchronous IsValid, as in the example, so a missed async call fails loudly instead of letting bad data through.
Mistake 2 — Upgrading EF Core packages without upgrading .NET
The mistake: Updating Microsoft.EntityFrameworkCore.SqlServer to 11.x in a project that still targets net10.0.
The fix: EF Core 11 requires .NET 11. Change the target framework to net11.0 first, or stay on EF Core 10 packages.
When Should I Use It?
- Async validation: uniqueness checks, checks against another service, anything that awaits.
- Unions in APIs: endpoints whose response genuinely has several shapes.
- Zstandard: APIs with large JSON responses where bandwidth matters.
- **FullJoin and MaxByAsync:** reports and data-quality checks in EF Core.
- **database update --add:** containers and Aspire setups, and quick local iterations.
Mental Model
EF Core 11: FULL JOIN and MaxBy in SQL, migrations in one step; requires .NET 11.
Your existing API and EF code keeps working; adopt the new pieces where they remove a workaround.
Remember: version 11 of the frameworks moves common workarounds back into the framework.
Key Takeaway
- ASP.NET Core 11 adds async validation (AsyncValidationAttribute, IAsyncValidatableObject) that runs with builder.Services.AddValidation().
- C# 15 unions work in JSON bodies and appear as anyOf in OpenAPI, which now defaults to version 3.2.
- Zstandard compression is supported, and dotnet new mcpserver creates an MCP server for AI assistants.
- EF Core 11 translates FullJoin to FULL JOIN and supports MaxByAsync/MinByAsync; dotnet ef database update Name --add creates and applies a migration in one step.
- EF Core 11 requires .NET 11; check its breaking changes (such as SqlClient 7.0) when upgrading.
Check Your Understanding
Three questions to check the web and data highlights.
1. A validation rule must check the database to see whether a username is taken. What's the .NET 11 way to write it?
Show answer
Correct: B
Why B is correct: AsyncValidationAttribute exists for exactly this: rules that await I/O without blocking a thread, run automatically by the validation system.
Why A is incorrect: Blocking on .Result ties up a thread and can deadlock, which is the problem async validation solves.
Why C is incorrect: That works but scatters validation logic. The new attribute keeps it with the model.
Why D is incorrect: Since .NET 11 it can, with AsyncValidationAttribute.
Reinforcement: Rules that wait on I/O belong in async validators.
2. What does EF Core 11 send to a SQL database for context.Customers.FullJoin(context.Orders, ...)?
Show answer
Correct: B
Why B is correct: EF Core 11 translates the new LINQ FullJoin operator directly into SQL FULL JOIN, so the database does the work in one query.
Why A is incorrect: That was the workaround before. EF Core 11 translates the operator to SQL.
Why C is incorrect: FullJoin is new in .NET 11 and EF Core 11 supports it on relational databases.
Why D is incorrect: That's how people emulated full joins by hand. It's no longer needed.
Reinforcement: FullJoin in LINQ = FULL JOIN in SQL.
3. Which command creates a migration named AddProducts and applies it immediately with EF Core 11?
Show answer
Correct: B
Why B is correct: EF Core 11 added the --add option to dotnet ef database update. It scaffolds the migration, compiles it with Roslyn and applies it, while still saving the files to disk.
Why A is incorrect: migrations add has no --apply option. The new one-step option lives on database update.
Why C is incorrect: There's no dotnet ef migrate command.
Why D is incorrect: dotnet run doesn't run migrations.
Reinforcement: database update Name --add = create + apply.
You now know what's new across the language, runtime, libraries and frameworks. The final lesson of this Part turns it into a checklist: how to move a real project from .NET 10 (or 8 or 9) to .NET 11, step by step.