-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
When using MapWhen we get a lot of nesting:
app.MapWhen(ctx => ..., appBuilder =>
{
appBuilder.UseRouting();
appBuilder.UseEndpoints(routeBuilder =>
{
routeBuilder.MapGet(...);
});
}
app.MapWhen(ctx => ..., appBuilder =>
{
appBuilder.UseRouting();
appBuilder.UseCors();
appBuilder.UseEndpoints(routeBuilder =>
{
routeBuilder.MapPost(...);
});
}Describe the solution you'd like
It would be nice if we had a top-level API, for example:
var app1 = app.MapBranch(ctx => ...);
app1.UseRouting();
app1.MapGet(...);
var app2 = app.MapBranch(ctx => ...);
app2.UseRouting();
app2.UseCors();
app2.MapPost(...);MapBranch can return a new type implementing both IApplicationBuilder and IRouteEndpointBuilder.
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc