关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。
想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。
6年前关闭。
Improve this question
我正在学习 .NET MVC 并且我正在构建的应用程序变得非常像意大利面条。在我的代码中,我在不同的 Controller 中有许多 Action ,这些 Action 自然会产生各种 View 和局部 View 。更糟糕的是,我有 @Html.Action 命令增加了另一层困惑。其中一些是默认脚手架操作遗留下来的。
是否有任何工具可以生成我网站中所有可能路线及其返回的 View 的列表?
我还想找到所有未使用的 View 和没有 View 的操作,并且通常正确地重构所有内容。像这样的东西(请不要评论这个特定的例子):
Route Views returned
------------------------------------------
/User/Edit /User/Edit.cshtml
/Admin/User/Edit /User/Edit.cshtml
...
这样的事情存在吗?可以用 .tt 模板完成吗?
或者也许我的整个方法是错误的..!
最佳答案
这些也许可以帮助您:
我还没有测试过 Mvc Route Visualizer,但它似乎可以满足您的要求。
编辑:
也许这对你更有效。它不会向您显示返回的 View ,但它至少会显示所有 Controller 和操作:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
, 添加以下代码行:routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// If you don't have "HomeController", choose another controller you have.
// MvcCodeRouting will look for all controllers in the same namespace and sub-namespaces as the one specified here.
routes.MapCodeRoutes(typeof(HomeController), new CodeRoutingSettings
{
UseImplicitIdToken = true
});
// Other, existing, routes here...
关于.net - 列出 MVC 路由的工具 - Visual Studio Express,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13646034/