Skip to content

Add new "MapAction" overloads #30448

Closed
@halter73

Description

@halter73
  1. Don't call the overloads "MapAction". Add overloads to the existing MapGet/MapPost/MapDelete/Map extension methods. We should remove the existing MapAction method.
namespace Microsoft.AspNetCore.Builder
{
    public static class EndpointRouteBuilderExtensions
    {
        public static IEndpointConventionBuilder Map(this IEndpointRouteBuilder endpoints, string pattern, Delegate action);
        public static IEndpointConventionBuilder MapGet(this IEndpointRouteBuilder endpoints, string pattern, Delegate action);
        public static IEndpointConventionBuilder MapPost(this IEndpointRouteBuilder endpoints, string pattern, Delegate action);
        public static IEndpointConventionBuilder MapPut(this IEndpointRouteBuilder endpoints, string pattern, Delegate action);
        public static IEndpointConventionBuilder MapDelete(this IEndpointRouteBuilder endpoints, string pattern, Delegate action);
}
  1. Create overloads without the string pattern parameter for people you still want to use RouteAttribute. This should throw an InvalidOperationException if there's no route attribute.
namespace Microsoft.AspNetCore.Builder
{
    public static class EndpointRouteBuilderExtensions
    {
        public static IEndpointConventionBuilder Map(this IEndpointRouteBuilder endpoints, Delegate action);
    }
}

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routing

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions