code世代:自定义模板控制器 [英] Code generation: Custom controller templates

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

问题描述

要开始,我使用Asp.Net MVC 4,我已经修改了我的解决方案,按照<一来包含codeTemplates文件夹href=\"http://blogs.msdn.com/b/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx\"相对=nofollow>这个教程。 (我想我的问题可能是MVC有关?)

To start off, I'm using Asp.Net MVC 4, and I've modified my solution to contain the CodeTemplates folder by following this tutorial. (I think my issue might be MVC related?)

我已经取代了阿贾克斯网格模板中的code用我自己的jqGrid的模板,这是罚款,让我的项目开工。但我无法创造全新的控制器模板(好让他们在创造新的控制器菜单显示)

I've replaced the code in the Ajax grid template with a with my own JQgrid-template, which was fine for getting my project started. But I'm having trouble creating completely new controller templates (well the having them show up in the create new controller menu)

什么想法?

更新

我已经采取了一些刺在使用脚手架的功能,但它不完全是我脑子里想的(虽然它的工作像预期的。我观看了上那是相当翔实的话题史蒂夫·桑德森视频),任何办法让我的自定义视图/外接控制器的GUI里的控制器?

I've taken a few stabs at using the scaffolding feature, but it's not exactly what i had in mind (although it does work like expected. I watched a video by steve sanderson on the topic that was quite informative), any way to get my custom views/controllers inside the add controller gui?

推荐答案

至于我对你的问题的理解的话,你无法管理一个名为.ps1文件,这相当于你的AddController目录中的两个控制器。
您必须使用程序包管理器,并发出像

As far as my understanding of your problem goes, you cannot manage two controllers within one .ps1 file, which corresponds to your "AddController" directory. You have to use the Package Manager and issue a command like

Scaffold CustomScaffolder <choose-name>

这将产生以下codeTemplates另一个子文件夹的名称。从那里,你喜欢你与你现有的那样打开和编辑T4文件。

This will generate another subfolder below CodeTemplates with the name . From there, you open and edit t4 files like you did with your existing one.

更多信息<一个href=\"http://blog.stevensanderson.com/2011/04/07/mvcscaffolding-creating-custom-scaffolders/\">here

这篇关于code世代:自定义模板控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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