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

查看:85
本文介绍了我如何创建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模板。 <一href=\"http://blogs.msdn.com/b/joecar/archive/2011/01/06/add-the-asp-net-mvc-3-$c$c-templates-to-your-application-with-nuget.aspx\">Here's概述。

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

下面的步骤是:


  1. 在程序包管理器控制台类型:安装包MVC3 codetemplatescsharp

  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)的\\微软的Visual Studio 10.0 \\ Common7 \\ IDE \\的ItemTemplate \\ CSHARP \\网络\\ MVC 3 \\ codeTemplates \\ 文件夹中。

Or if you want to modify those globally you could to this in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC 3\CodeTemplates\ folder.

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

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