5
votes

I was developing with cakephp for a few years and now want to try out asp.net mvc.

In cakephp there is a bake plugin, that allows to create standard functionalities based on customizable templates. E.g. changing these templates according to my needs

1) for controller

https://github.com/cakephp/bake/blob/master/src/Template/Bake/Controller/controller.ctp https://github.com/cakephp/bake/blob/master/src/Template/Bake/Element/Controller/index.ctp https://github.com/cakephp/bake/blob/master/src/Template/Bake/Element/Controller/add.ctp

2) for model file

https://github.com/cakephp/bake/blob/master/src/Template/Bake/Model/table.ctp

3) for view files

https://github.com/cakephp/bake/blob/master/src/Template/Bake/Template/index.ctp https://github.com/cakephp/bake/blob/master/src/Template/Bake/Element/form.ctp

I could run a command from CLI and get full functional validation, controller files with actions and view files - based on the existing tables' structures and relations between them. The plugin will create actual php files in corresponding directories with content according to template files. Having pre-customized bake templates allows to generate the CRUD or any other custom functionality in a few minutes.

Is there a similar functionality in asp.net mvc (v5 or above)? The desired features are to be able to fully customize the templates, which will be used to create controllers, cshtml files and model files - assuming that we already have the tables with foreign key associations in the database. (Preferably free, but not necessarily)

Thanks

1
AFAIK, in ASP .NET MVC we called it as "scaffolding" feature, which creates controllers and views based from generated database model classes. Model classes can be generated from existing database using Entity Framework, DBML, XPO, ODBC or other data sources, then you can use scaffolding by creating "New Scaffolded Item" in Controllers directory.Tetsuya Yamamoto
Is Rafael answer helped you?Ali Soltani

1 Answers

1
votes

I think this link might help you with templates in visual studio. If you want to use command line, maybe yeoman can help you. See this link to see if it'll work for you.