As with controllers, the scaffolding for views can also be customized. In our example project used throughout this book, our views followed a consistent look. Each page has a page header followed by a breadcrumb
component to indicate to the user which page is currently being viewed.
We always want to follow this design when adding a new page to our site, and one method of enforcing this is to either override the default scaffolder for views or add our own. We'll create a T4 template that will generate a standard, vertical Bootstrap form that already contains a page header and a breadcrumb
component. To accomplish this, perform the following steps:
Open the
MvcView
folder inside theCodeTemplates
folder.Right-click on the
Create.cs.t4
file and select Copy.Right-click on the
MvcView
folder and select Paste.The file will be copied as
Create.cs – Copy.t4
; rename it toVerticalForm-Bootstrap.cs.t4
.Double-click on
VerticalForm-Bootstrap.cs.t4
to open it.Add...