Code generation: Custom controller templates

旧时模样 提交于 2019-12-30 06:14:09

问题


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?)

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)

any ideas?

Update

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?


回答1:


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>

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.

More info here



来源:https://stackoverflow.com/questions/8998855/code-generation-custom-controller-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!