[MVC][01]Using scaffold to automatically create MVC CRUD site
Environment: visual studio 2017
Create a new project choosing "asp.net web application(.net framework)":
choose "empty" application and "MVC" reference:
if you don't have your own test database, refer to this post to Create your first local db and table with visual studio
add a ado.net entity model in your "Models" folder of your project
choose model type "EF Designer from database", and you'll get the access of Actor table:
Build your project! It is necessary before we add a controller to use scaffold to create MVC CRUD site.
add a controller in the "Controllers" folder of your project, choose "Controller with views, using Entity Framework":
and select options as follows:
(optional)change your RouteConfig.cs in the App_Start folder, change controller to "Actors":
this is for lazy people like me, you don't have to do this.
press F5 to start the MVC CRUD site:
MVC CRUD site done!
Reference:
Experience from myself