Closed
Description
Background and Motivation
The new minimal approach in asp.net core 6 is good. I mean it's great. But I don't this will be useful in a real web application. Because this doesn't have an easy way to integrate route grouping. With route grouping, minimal actions can be separated into multiple files easily with the help of normal or static(since c# doesn't support modules like f#) classes without using MVC or Razor pages.
Proposed API
namespace Microsoft.AspNetCore.Builder;
+ public class RouteGroup : IApplicationBuilder, IEndpointRouteBuilder
+ {
+ // Needed members to implement those interfaces
+ }
public class MinimalActionEndpointRouteBuilderExtensions
{
+ public static void IncludeRouteGroup(this IEndpointRouteBuilder endpoints, string pattern, RouteGroup routeGroup);
}
Usage Examples
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
RouteGroup usersRoutes = new();
usersRoutes.MapGet("{id}", (int id) => GetUserById(id));
app.IncludeRouteGroup("/api/users/", usersRoutes);
You can separate these route actions to multiple files easily. RouteGroup would become more useful if in the future c# gets support for top-level functions(not just for Program.cs).
Metadata
Metadata
Assignees
Labels
Work that we can't release withoutAPI was approved in API review, it can be implementedIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcController-like actions for endpoint routing*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels