Closed
Description
Vision
#!/usr/bin/env dotnet run
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSqlite<Todo>(builder.Configuration["connectionString"] ?? "Data Source=todos.db");
var app = builder.Build();
// ...
// Step 5: Input validation
app.MapPost("/todos", async (Validated<Todo> inputTodo, TodoDb db) =>
{
var (todo, isValid) = inputTodo;
if (!isValid) return Problem(inputTodo);
db.Todos.Add(todo);
await Todos.SaveChangesAsync();
return CreatedAt(routes.GetTodo.Url(todo.Id), todo);
};
app.Run();
// ...
From: #30580 User learning arc for new minimal/focused ASP.NET Core API experience
Minimal Action Feature Work
- Implement a minimal version of MapAction #29684 Implement a minimal version of MapAction
- Add benchmarks for MapAction #29915 Add benchmarks for MapAction
- Add new "MapAction" overloads #30448 Add new "MapAction" overloads
- Add API to turn delegate or MethodInfo into a RequestDelegate #31181 Add API to turn delegate or MethodInfo into a RequestDelegate
- Add OpenAPI/Swagger support to minimal actions #30662 Add OpenAPI/Swagger support to minimal actions
- Create IResult-returning static methods #33729 Create IResult-returning static methods
- Add IResult implementations for more IActionResults #32565 Add IResult implementations for more IActionResults
- RequestDelegateFactory should produce clear errors for invalid Delegates #30322 RequestDelegateFactory should produce clear errors for invalid Delegates
- Use CultureInfo.InvariantCulture when TryParsing minimal action parameters #32377 Use CultureInfo.InvariantCulture when TryParsing minimal action parameters
-
Add easier way to name endpoints for easier link generation #33687 Add easier way to name endpoints for easier link generationCut - Use nullibility to infer optionality of service and body parameters #32375 Use nullibility to infer optionality of service and body parameters
-
Infer collection interfaces like IList come from the body in minimal actions #32376 Infer collection interfaces like IList come from the body in minimal actionsCut Design validation for Minimal APIs #30666 Design validation for minimal actions(cut for .NET 6)Use InferFromServicesAttribute to infer non-interface parameters in minimal actions come from services #32563 Use InferFromServicesAttribute to infer non-interface parameters in minimal actions come from servicesReplaced by Detect services based on service provider #32737Enable customization of input and output formatting in MapAction #30668 Enable customization of input and output formatting for minimal actions (out of scope?)Add linker-friendly Roslyn source gen version of RequestDelegateFactory #30670 Add linker-friendly Roslyn source gen version of RequestDelegateFactory
Minimal Hosting Feature Work
- "Minimal hosting" for ASP.NET Core applications #30354 "Minimal hosting" for ASP.NET Core applications
- ResolveServiceProviderFactory should work with Minimal Hosting #31861 ResolveServiceProviderFactory should work with Minimal Hosting
- Support the new top level statements with WebApplicationFactory #33462 Make WebApplicationFactory work with top level statements (without CreateHostBuilder entry point)
- Add default global usings to Microsoft.NET.Sdk.Web #32451 Add default global usings to Microsoft.NET.Sdk.Web
-
Add better certificate configuration support to WebApplication #32124 Add better certificate configuration support to WebApplicationCut
Minimal Hosting Bugs
- Web root is incorrect when using new minimal hosting API (WebApplication.CreateBuilder) #32415 Web root is incorrect when using the minimal host
- Minimal host does not read environment specific configuration for logging #32383 Minimal host does not read environment specific configuration
- WebApplication.CreateBuilder potentially inefficient, results in many file system checks #32432 [Perf] WebApplication.CreateBuilder potentially inefficient, results in many file system checks
- Use a ChainedConfigurationSource to share sources between WebApplicationBuilder and inner host #33082 Use a ChainedConfigurationSource to share sources between WebApplicationBuilder and inner host
- Remove Configuration.AutoUpdate #33083 Remove Configuration.AutoUpdate
Project Templates
- Add empty template for Minimal Scenarios #30665 Add empty template for Minimal Scenarios
- Remove the cast from the empty web project template #33393 Remove cast from empty template
- Remove <LangVersion>preview from empty web template #33813 Remove
<LangVersion>Preview</LangVersion>
from empty web template - Update ASP.NET Core C# project templates to use new minimal hosting APIs in .NET 6 #33944
- Update ASP.NET Core F# project templates to use new minimal hosting APIs in .NET 6 #34123
- Update blazorwasm-hosted templates to use minimal host #32471 Update blazorwasm-hosted templates to use minimal host
Docs
- Add getting started docs for minimal hosting #31992 Add getting started docs for minimal hosting