ASP.NET MVC 5自定义脚手架选项[t4模板]

博士 阿里姆·卡里姆(Alim Ul Karim)

目前,我正在开发一个框架,我想在Visual Studio菜单中添加自定义脚手架选项。

自定义脚手架选项

默认情况下对话框中的使用实体框架的带有视图的MVC5控制器”选项3选择“ CodeTemplates \ MvcControllerWithContext \ Controller.cs.t4”,该t4再次将视图t4模板定位到其中

  • “ CodeTemplates \ MvcView \ ModelMetadataFunctions.cs.include.cs.t4”
  • “ CodeTemplates \ MvcView \ Create.cs.t4”
  • “ CodeTemplates \ MvcView \ Edit.cs.cs.t4”
  • “ CodeTemplates \ MvcView \ Delete.cs.cs.t4”
  • “ CodeTemplates \ MvcView \ List.cs.cs.t4”

可视化

I have been modifying t4 templates almost a year, I haven't found a single piece of evidence that suggest that how it is targeting those views or how to add option in the scaffolding dialog. I have googled a lot , however haven't found anything close.

In summary , I am only looking for the place where I can add or modify the locations for those t4 templates and add a reference of a new scaffold in the scaffolding dialog box.

Any of the answer will be dearly appreciated. Thank you.

dmcquiggin

Before continuing to implement your framework using T4, you should be aware that the ASP.Net vNext team have quietly dropped support for T4 from MVC6 projects, so unless that decision is reversed, you will not be able to upgrade your framework.

As of Visual Studio 2015 CTP6, MVC6 projects do not support Single File Generators, which are a requirement for T4. The reasons given by the ASP.Net vNext team are described on the official GitHub repository for ASP.Net.

https://github.com/aspnet/Home/issues/272

UPDATE

David Fowler from the team has now (29-04-2015) confirmed that Single File Generators will be supported in MVC6, which in turn should allow support for T4.

UPDATE 2

To revert back to your original question on the topic of using Custom Code Templates for Scaffolding, this is not finalised for MVC6 and Visual Studio 2015.

我在上面提到的ASP.Net GitHub问题跟踪器线程上提出了这个问题;易卜拉欣·哈希米(MSFT)说,将就采用哪种技术和实现方式进行一些讨论,目前主要的候选者是T4或Razor发电机。

Sayed指出了以下文章,该文章显示了一些早期想法,但强调指出,这尚未最终确定,人们不应该花时间对这种方法进行投资,因为它可能会改变

http://blogs.msdn.com/b/webdev/archive/2014/08/23/how-to-customize-scaffolding-templates-for-asp-net-vnext.aspx

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在 ASP.net Core MVC 2 中使用 ASP.net MVC 5 脚手架

ASP.NET MVC脚手架视图-缺少模型属性

asp.net mvc core 2 脚手架生成控制器中的错误

Asp.Net Core 3.0 MVC-文化Cookie的脚手架身份页面路由

ASP.NET Core-类似于MVC的脚手架身份

如何在Rider IDE中进行ASP.NET MVC视图脚手架?

如何在VS 2015中自定义ASP.NET MVC 5支架?

ASP.NET MVC 5-脚手架为多对一关系

Asp.Net Core MVC电影应用程序-脚手架项目无法正常工作

脚手架安装后,asp.net mvc核心索引页上显示外键的问题

在带有EF的脚手架控制器ASP.NET MVC的索引方法中添加where子句

.net MVC 脚手架模板:检查模型是否包含属性

VS 2019中ASP.NET Core Razor脚手架模板的位置是什么

ASP.NET MVC 4自定义句柄错误

ASP.NET MVC 4自定义URL

Asp.Net核心和脚手架

缺少脚手架ASP.Net Core

如何使用EF Core更新ASP.NET 5中的dbcontext脚手架?

使用ASP.NET Core 2.1 MVC中的Entity Framework Core脚手架新控制器时出现问题

如何在asp.net MVC核心中设置身份脚手架项目/页面如何初始页面?

为什么 ASP.NET Core MVC 添加的 Edit() 操作方法 (POST) 脚手架中的 ID 参数会传递两次?

已解决 - 如何在 ASP.NET Core MVC 中使用脚手架?我收到一个错误

如何在多个项目中创建自定义脚手架(MVC +类库)

ASP.NET MVC 4模板

ASP.NET MVC自定义多字段验证

ASP.NET MVC中的自定义错误页面

asp.net mvc自定义子路由

ASP.Net MVC Kendo网格的自定义分页

自定义标头ASP.net MVC