新的T4模板控制器在MVC3 [英] NEW T4 Controller Template in MVC3

查看:118
本文介绍了新的T4模板控制器在MVC3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你所知道的MVC创造新的T4模板,需要添加 codeTemplates 文件夹项目。主要有两个子文件夹1 - AddController ,2 - AddView 我总是用 AddView 文件夹中添加新的模板生成自定义视图,知道我需要新的模板来生成控制器,但是当我添加新的 TT 文件 AddController 文件夹,也没有在新的控制器模板任何新的选择,总有3个选项:

As you know to create new t4 templates in MVC, need to add CodeTemplates folder to project. There are two main subfolders 1-AddController, 2-AddView I always use AddView folder to add new templates to generate custom views, know I need new template to generate controllers, but when I add new tt file to AddController folder, there is no any new option in templates of new controller, there is always 3 options:

所以,我怎么能添加新的选项添加控制器窗口中使用我的自定义控制器模板?
或者,如果我尝试错误的方法,你有什么建议,使用模板来生成控制器?

So how can I add new option to Add Controller window to use my custom Controller Template? Or if I try wrong way, what is your suggestion to use Template to generate controllers?

推荐答案

看来你只能使用的 MvcScaffolding 的NuGet包:

It seems you can only extend the Add Controller dialog with using the MvcScaffolding nuget package:

asp.net页面

在ASP.NET MVC 3工具更新包括伟大的Visual Studio支持
  此脚手架系统,如:

The ASP.NET MVC 3 Tools Update includes great Visual Studio support for this scaffolding system, such as:


      
  • 添加控制器对话框现在支持创建,读取,更新的全自动脚手架和删除控制器动作和相应的
      意见。默认情况下,该脚手架使用EF code数据访问code
      首先。

  •   
  • 添加控制器对话框支持通过的NuGet包扩展支架,如MvcScaffolding。这允许定制堵塞
      支架到这将允许您创建支架的对话框
      用于其他的数据访问技术,如NHibernate的或甚至射流与
      适用于ODBCDirect,如果你愿意!

  •   
  • Add Controller Dialog now supports full automatic scaffolding of Create, Read, Update, and Delete controller actions and corresponding views. By default, this scaffolds data access code using EF Code First.
  • Add Controller Dialog supports extensible scaffolds via NuGet packages such as MvcScaffolding. This allows plugging in custom scaffolds into the dialog which would allow you to create scaffolds for other data access technologies such as NHibernate or even JET with ODBCDirect if you’re so inclined!

您可以开始学习MvcScaffolding <一个href=\"http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/\"相对=nofollow>从这篇文章。

You can start learning about MvcScaffolding from this article.

这篇关于新的T4模板控制器在MVC3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆