Automatically generate lowercase dashed routes in ASP.NET Core
<p>ASP.NET Core uses CamelCase-Routes like <a href="http://localhost:5000/DashboardSettings/Index" rel="noreferrer">http://localhost:5000/DashboardSettings/Index</a> by default. But I want to use lowercase routes, which are delimitted by dashes: <a href="http://localhost:5000/dashboard-settings/index" rel="noreferrer">http://localhost:5000/dashboard-settings/index</a> They're more common and consistent, cause my application extends a website running Wordpress, which also has lowercase urls with dashes. </p>

<p>I learned that I can change the urls to lowercase using the routing-options: </p>

<pre><code>services.ConfigureRouting(setupAction =&gt; {
    setupAction.LowercaseUrls = true;
});
</code></pre>

<p>This works but gave me urls without any delimiter like <a href="http://localhost:5000/dashboardsettings/index" rel="noreferrer">http://localhost:5000/dashboardsettings/index</a> which are badly readable. I could define custom routes using the route attribute like </p>

<pre><code>[Route("dashboard-settings")]
class DashboardSettings:Controller {
    public IActionResult Index() {
        // ...
    }
}
</code></pre>

<p>But that causes extra-work and is error-prone. I would prefer an automatic solution which search for uppercase chars, insert a dash before them and make the uppercase-char lowercase. For the old ASP.NET this was not a big issue, but on ASP.NET Core I see no direction how to handle this. </p>

<p>Whats the way to do this here? I need some kind of interface where I can generate urls (like for the tag helpers) and replace there the CamelCase by dash-delimiters. Then I need another kind of interface for the routing, so that the dash-delimiter urls are converted back to CamelCase for correct matching with my controller/action names. </p>