[RESOLVED]Auto Creation of Controllers

I want to auto generate controllers based upon my edmx. When the edmx is created , automatically the model is created for all the tables in the edmx. In the same way is there any option to generate controllers for all the tables with out generating it manually
. I know it can be done by customizing the T4 template file, but i don’t how to customize to achieve this one. Any help will be appreciated !!

Hi,

By "manually" you mean entirely yourself or are you using already http://www.asp.net/visual-studio/overview/2013/aspnet-scaffolding-overview that could be a first step?

Try also http://blogs.msdn.com/b/webdev/archive/2014/04/03/creating-a-custom-scaffolder-for-visual-studio.aspx and if not done already, search
nuget for existing scaffolders…

Hi ,

  "Manually" means, using the scaffolding only.. But what i meant is we have to select each model , then the controller and views will be scaffold ed for that model..  What i need is when i create the edmx , controllers for all models in the edmx should
be created. For example when we create the edmx , model for all tables on the edmx is generated using T4.  In the same way the controllers should also be generated for all the models.. 

Hi,

As far as I know, there isn’t that feature in VS, I suggest that you could submit user voice:
http://aspnet.uservoice.com/forums/41199-general-asp-net. If you submit this suggestion, you might post that link here which will benefit others who has the similar issue.

Best Regards

Starain

Please check the nugget package MvcScaffolding. I believe it has the capability to generate controllers and views for all the model (you may have to run a command line statement)

http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/

Leave a Reply