目前,我正在开发一个框架,我想在Visual Studio菜单中添加自定义脚手架选项。
默认情况下,对话框中的“使用实体框架的带有视图的MVC5控制器”选项3选择“ CodeTemplates \ MvcControllerWithContext \ Controller.cs.t4”,该t4再次将视图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.
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指出了以下文章,该文章显示了一些早期想法,但强调指出,这尚未最终确定,人们不应该花时间对这种方法进行投资,因为它可能会改变。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句