-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!The bug or enhancement requested in this issue has been checked-in!area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingfeature-routing
Milestone
Description
Today it's possible to use the LinkGenerator to generate links to arbitrary endpoints but it's a little inconvenient to do this for endpoints that exists outside of MVC because they don't have intrinsic names or route values (like "controller" and "action").
Here's an example of what this looks like this today:
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", (LinkGenerator linkGenerator) =>
{
return linkGenerator.GetPathByName("todos", values: new { id = 13 });
});
app.MapGet("/todos/{id}", (int id) => { }).WithMetadata(new EndpointNameMetadata("todos"));
app.Run();Some ideas:
- We add an extension method WithName to hide the explict metadata addition.
- Automatically infer some defaults based on route template.
- Automatically infer some defaults based on method name (if not compiler generated).
Metadata
Metadata
Assignees
Labels
✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!The bug or enhancement requested in this issue has been checked-in!area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingfeature-routing