dotnet / dotnet/aspnetcore

Support Controller suffix in MapControllerRoute

Open
#27,204 5 comments 4 reactions 0 assignees View on GitHub
affected-medium area-mvc enhancement feature-routing severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

This would allow MapControllerRoute to be used with nameof more seamlessly:

Today we have to do something like this:

```C#
endpoints.MapControllerRoute("name", "/{**path}", defaults: new
{
controller = nameof(HomeController).Replace("Controller", ""),
action = nameof(HomeController.Hello)
});

```

This would be better:

```c#
endpoints.MapControllerRoute("name", "/{**path}", defaults: new
{
controller = nameof(HomeController),
action = nameof(HomeController.Hello)
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.