简体   繁体   English

如何自动将ASP.NET MVC操作名称转换为虚线URL?

[英]How to automatically convert ASP.NET MVC action names to dashed URLs?

Let's say I have this action method in my ApplicationController 假设我的ApplicationController有这个动作方法

public ActionResult MyActionMethodName()
{
    ...
}

I want this (and all methods that doesn't have a specific route) method's route to be /application/my-action-method-name without manually specifying it. 我希望这个(以及没有特定路由的所有方法)方法的路由是/application/my-action-method-name而不需要手动指定它。 Some special route or package that can convert action methods names in PascalCase to dashed routes. 一些特殊的路由或包,可以将PascalCase中的操作方法名称转换为虚线路径。

Is there something like that? 有类似的东西吗?

我发现这个项目是一个NuGet包 ,它将所有操作方法名称转换为lowercased-dashed-routes。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM