Closed
Description
Background and Motivation
RouteGroupBuilder
sounds better than GroupRouteBuilder
. In the original API proposal (#36007) this was called RouteGroup
which is closer to the name I am suggesting here. RouteGroup
is also an alternative name that I think is better than GroupRouteBuilder
. I proposed GroupRouteBuilder
in the follow up comments because it better aligned with IEndpointRouteBuilder
, but now I think that's unimportant.
Proposed API
namespace Microsoft.AspNetCore.Routing;
- public sealed class GroupRouteBuilder : IEndpointRouteBuilder, IEndpointConventionBuilder
+ public sealed class RouteGroupBuilder : IEndpointRouteBuilder, IEndpointConventionBuilder
Usage Examples
Before
GroupRouteBuilder group = app.MapGroup("/todos");
group.MapGet("/", (int id, TodoDb db) => db.ToListAsync());
After
RouteGroupBuilder group = app.MapGroup("/todos");
group.MapGet("/", (int id, TodoDb db) => db.ToListAsync());
Alternative Designs
- Keep it as
GroupRouteBuilder
since that puts "Group" up front even if using "Group" as an adjective sound weird. - Go with the ven shorter
RouteGroup
.
Risks
Low. It's only been released in preview4
and it would only break apps that reference the type name instead of just using var
.