Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

MVC Scaffolding Made Easy


Published on

- Intro to MVC Scaffolding, CodeFirst, Repository Pattern
- Customizing view and Controller Templates
- Using T4 Scafoldering Commandlets
- Packaging Custom Scaffolder
- Customizing Scaffolding Environment

Scaffolding is a way to quickly create an application layout based on data. This means there are less routine tasks that developers need to do, for example, creating your own controllers/views, CRUD methods, and validation, and more time spent on solving business problems. Learn how to customize the scaffolding using T4 templates, so that the generated output suits the needs of your application, in case you need to regenerate the scaffolding occasionally during development.

Published in: Technology, Business
  • Be the first to comment

MVC Scaffolding Made Easy

  1. 1.
  2. 2. …generate “starter” code……provide a extensibility mechanism to customizegenerated code……generate more than just MVC Controllers andViews…
  3. 3. Install-Package MvcScaffoldingScaffold Controller Product
  4. 4. Invoke-Scaffolder “Scaffold” Alias scaffoldingTabExpansion (context command line switch)
  5. 5. Action • MvcScaffolding.Action Controller • MvcScaffolding.ControllerCustomScaffold • T4Scaffolding.CustomScaffolderCustomTemplate • T4Scaffolding.CustomTemplate DbContext • T4Scaffolding.EFDbContext Repository • T4Scaffolding.EFRepository UnitTest • MvcScaffolding.ActionUnitTest View • MvcScaffolding.RazorView Views • MvcScaffolding.Views
  6. 6. Get-DefaultScaffolder ControllerSet-DefaultScaffolder Controller MvcScaffolding.ControllerWithRepository
  7. 7. Action:Scaffold Action -Controller TasksController -Action Foo -ViewModel TaskUnit Test:Scaffold UnitTest -Controller TasksController -Action CreateBoth in 1 shot:Scaffold MvcScaffolding.ActionWithUnitTest -Controller TasksController -ActionArchiveTask -ViewModel Task
  8. 8. Scaffold CustomTemplate <ScaffolderName> <TemplateName>Scaffold CustomTemplate View Index
  9. 9. Add- Add- Add-ClassMember Find-ScaffolderTemplate Get-DefaultScaffolder ClassMemberViaTemplate ProjectItemViaTemplate Get-Get-PluralizedWord Get-PrimaryKey Get-ProjectFolder Get-ProjectItem ProjectAspNetMvcVersionGet-ProjectLanguage Get-ProjectType Get-RelatedEntities Get-Scaffolder Get-SingularizedWord Invoke-Scaffolder Invoke-ScaffoldTemplate Set-DefaultScaffolder Set-IsCheckedOut
  10. 10. Whether n00b(ie) or Expert:Scaffolding should be a tool in your toolbox!
  11. 11.