Create Custom MvcScaffolding

Hi,

I want to create my custom MvcScaffolding for crud operations using entity framework

and also i want to create a package of it say (MyCustomScaffolding) , so that i can install the package using the following command

PM> Install-Package MyCustomScaffolding

then it should create the controller , views under a Area or specific location mentioned.

I googled regarding this , but i found few articles that are customizing the existing templates and copied into project solution within a folder "CodeTemplates"

I dont want to go with this approach , as there is a maintenance problem , because i am planing to have 4 custom scaffolding and i dont want to check-in the TFS,

instead I want to generate a dll.

Thanks,

Vijay

yours is a three step process 

1) create the vs IDE scaffolding code:

  http://blogs.msdn.com/b/webdev/archive/2014/04/03/creating-a-custom-scaffolder-for-visual-studio.aspx

2) create package for the code:

   http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package

3) create a custom feed for packages:

   http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds

the most difficult part is learning the visual studio sdk, that allows you to update projects, and add items. also you will need to learn a little about generating code with the code dom.

Hi,

At last i have found an article

http://www.codeproject.com/Articles/593605/All-you-need-to-create-a-Nuget-package-for-ASP-NET

First  I created a class library and then i added the code templates to the class library and customized them.

Then i created a NuGet Package for this class library using NuGet GUI Explorer and 

then i installed into my Project.

using this i achieved my task , but i don’t want to inject the content into my project, since i have more custom scaffolding templates of different types and 

there will be a maintenance problem.

The class library should take care of creating the controller with the custom scaffolding templates.

Are there any events in which we can call an external method while creating a controller.

Thanks,

Vijay

 

Hi,

First, i thank you for your reply

In first step , can’t we do without using sidewaffle because i dont have the pre-requisites installed

Thanks,

Vijay

Leave a Reply