ASP.NET MVC 中的脚手架控制器

发布于 2024-10-05 20:52:57 字数 446 浏览 0 评论 0原文

对于 ASP.NET MVC(v2 和 v3 RC)中的脚手架控制器,我们有哪些选项?我了解代码模板文件夹和 T4,但它只允许创建一个 .tt 文件,因此,用您自己的模板替换默认控制器模板,但我需要的是针对各种类型的控制器的不同类型的模板。

我听说 Rails 对此给予大力支持。我还知道 MVC 3 中的 MvcScaffold 包(通过 NuGet)由 Scott Hanselman 开发,支持 ControllerWithContext 和 ControllerWithRepository,但我想更进一步,因为源代码尚未发布(至少我不知道),所以我无法对其进行太多自定义。

大家都用什么或者做什么?

What options do we have for scaffolding controllers in ASP.NET MVC (v2 and v3 RC)? I know about the code templates folder and T4 but it only allows creating one .tt file and thus, replacing the default controller template with your own but what I would need is different types of templates for various types of controllers.

I've heard that Rails has huge support for this. I'm also aware of the MvcScaffold package in MVC 3 (via NuGet) as described and developed by Scott Hanselman which supports ControllerWithContext and ControllerWithRepository but I would like to take this further and since the source code hasn't been published (at least I'm not aware of it) there isn't much I can do to customize it.

What do you guys use or do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗梦空间 2024-10-12 20:52:57

通用控制器 (控制器)技术。大粉丝。

There is the Generic Controller (Controller<T>) technique. Big fan.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文