OUT-OF-DATE.md
Generated: 2026-03-06
Repository: practical-aspnetcore
Total Samples Analyzed: 637
Outdated Samples Identified: 14
Migrated: 12 ✅
Remaining: 2
| Sample | Category | Migration |
|---|---|---|
minimal-api/open-api-1 | OpenAPI | Swashbuckle → Built-in |
minimal-api/open-api-2 | OpenAPI | Swashbuckle → Built-in |
minimal-api/map-group-2 | OpenAPI | Swashbuckle → Built-in |
minimal-api/map-group-3 | OpenAPI | Swashbuckle → Built-in |
minimal-api/map-4 | OpenAPI | Swashbuckle → Built-in |
authentication/authentication-4 | OpenAPI | Swashbuckle → Built-in |
authentication/authentication-5 | OpenAPI | Swashbuckle → Built-in |
mini/minimal-api-pokedex | OpenAPI | Swashbuckle → Built-in |
mvc/nswag | OpenAPI | NSwag → Built-in |
sse | SSE | Manual → Built-in |
ihosted-service/ihosted-service-1 | Background | Custom base → BackgroundService |
| Sample | Priority | Notes |
|---|---|---|
mvc/nswag-2 | LOW | Alternative approach, kept for reference |
generic-host/generic-host-1/2 | LOW | Still valid for non-web scenarios |
This report identifies samples that were outdated due to new APIs and features available in .NET 10 / ASP.NET Core 10. 12 samples have been successfully migrated to use modern patterns.
BackgroundService base classBefore (Swashbuckle):
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
app.MapGet("/greeting", Hello.GetGreeting).WithOpenApi(op => { ... });
After (Built-in OpenAPI):
builder.Services.AddOpenApi();
var app = builder.Build();
app.MapOpenApi();
app.MapScalarApiReference();
/// <summary>
/// Return greeting given name
/// </summary>
app.MapGet("/greeting", Hello.GetGreeting);
Before (Manual):
app.MapGet("/sse", async context =>
{
context.Response.ContentType = "text/event-stream";
await context.Response.WriteAsync($"data: {data}\n");
await context.Response.Body.FlushAsync();
});
After (Built-in):
app.MapGet("/sse", (CancellationToken ct) =>
{
async IAsyncEnumerable<string> GetEvents([EnumeratorCancellation] CancellationToken ct)
{
while (!ct.IsCancellationRequested)
{
yield return $"Event at {DateTime.UtcNow}";
await Task.Delay(1000, ct);
}
}
return Results.ServerSentEvents(GetEvents(ct));
});
Before (Custom base):
public abstract class HostedService : IHostedService, IDisposable { /* 20+ lines */ }
After (BackgroundService):
public class MyService : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
// Do work
await Task.Delay(TimeSpan.FromSeconds(1), stoppingToken);
}
}
}
| Aspect | Before | After |
|---|---|---|
| Dependencies | Swashbuckle.AspNetCore | Built-in (no package) |
| OpenAPI Version | 3.0 | 3.1 |
| AOT Compatible | No | Yes |
| Code Simplicity | More boilerplate | XML comments |
| Performance | Good | Better (source generators) |
projects/net10/README.md - .NET 10 feature samplesprojects/net10/open-api-* - Built-in OpenAPI examplesprojects/net10/sse-* - Built-in SSE examples