如何在 ASP.NET MVC 3 中创建自己的脚手架模板? [英] How do I create my own Scaffold Template in ASP.NET MVC 3?

查看:21
本文介绍了如何在 ASP.NET MVC 3 中创建自己的脚手架模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET MVC 提供了选择脚手架模板"的能力,新创建的视图将基于该模板(添加视图 > 创建强类型视图 > 脚手架模板).

ASP.NET MVC provides the ability to select a 'Scaffold template' upon which a newly-created view will be based (Add View > Create a strongly-typed view > Scaffold template).

是否可以创建自己的脚手架模板?如果是这样,如何?

Is it possible to create your own Scaffold Template? And if so, how?

推荐答案

ASP.NET MVC 使用 T4 模板.这里是概述.

ASP.NET MVC uses T4 templates. Here's an overview.

步骤如下:

  1. 在包管理器控制台中输入:install-package mvc3codetemplatescsharp
  2. 接受所有警告
  3. CodeTemplates 文件夹将添加到包含模板的项目中
  1. In the Package Manager Console type: install-package mvc3codetemplatescsharp
  2. Accept all the warnings
  3. The CodeTemplates folder will be added to your project containing the templates

从这里您可以修改现有模板或添加新模板.

From here you could either modify the existing templates or add new one.

或者如果你想全局修改那些你可以在 C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEItemTemplatesCSharpWebMVC 3CodeTemplates 文件夹.

Or if you want to modify those globally you could to this in the C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEItemTemplatesCSharpWebMVC 3CodeTemplates folder.

这篇关于如何在 ASP.NET MVC 3 中创建自己的脚手架模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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