-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Priority:0Work that we can't release withoutWork that we can't release withoutapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
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).
aayushali, Nerajankc, Trivivium, Markz878, sps014 and 9 moreNerajankc and copernicus365aayushali, Nerajankc and copernicus365
Metadata
Metadata
Assignees
Labels
Priority:0Work that we can't release withoutWork that we can't release withoutapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels