Using Scaffolding to Generate a Controller and Views
This chapter has presented the details of building a controller and views manually. However, Visual Studio 2015 ASP.NET 5 MVC 6 include a tool for generating a controller class and a set of basic views (create, delete, details, edit, and index) based on your model. This tool is found in the DNX command line (discussed previously) and is called gen
. This can save a lot of time generating the basics. You can then adapt these files to your specific needs.
You can use dnx . gen
from the Developer Command Prompt for VS2015 console. The following walks you through this process using the Customer
and CustomerDbContext
model classes created previously:
1. Start by creating a new project based on the ...
Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.