http://geekswithblogs.net/mradradacz.mcp@gmail.com
…generate “starter” code……provide a extensibility mechanism to customizegenerated code……generate more than just MVC Contro...
Install-Package MvcScaffoldingScaffold Controller Product
Invoke-Scaffolder   “Scaffold” Alias       scaffoldingTabExpansion       (context command line switch)
Action       • MvcScaffolding.Action  Controller     • MvcScaffolding.ControllerCustomScaffold   • T4Scaffolding.CustomSca...
Get-DefaultScaffolder ControllerSet-DefaultScaffolder Controller MvcScaffolding.ControllerWithRepository
Action:Scaffold Action -Controller TasksController -Action Foo -ViewModel TaskUnit Test:Scaffold UnitTest -Controller Task...
Scaffold CustomTemplate <ScaffolderName> <TemplateName>Scaffold CustomTemplate View Index
Add-                            Add- Add-ClassMember                                                                      ...
Whether n00b(ie) or Expert:Scaffolding should be a tool in your              toolbox!
http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/http://mvcsc...
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
MVC Scaffolding Made Easy
Upcoming SlideShare
Loading in …5
×

MVC Scaffolding Made Easy

4,334
-1

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
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,334
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
46
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • “…it doesn’t generate code that suits my project.”“…the code is not complete enough for Production use.”“…I have a non-MVC project
  • First demo – default MvcScaffolding using diloguesDescribe filesAdd view WorkOrderAdd controler, new data contextDefault dB is SQL express – go lighter using SQL CEPM&gt; Install-Package EntityFramework.SqlServerCompactPM&gt; Install-Package MvcScaffoldingPM&gt; Scaffold Controller –ModelTypeWorkOrder –ControllernameWorkOrderController – DbContextTypeWorkOrderDbcontextMVC controllers best practiceencapsulate something in the interface leverage dependency injection (to make the controllers testable)Let’s add repository PM&gt; Scaffold Controller –ModelTypeWorkOrder –ControllernameWorkOrderController – DbContextTypeWorkOrder – RepositoryPM&gt; Scaffold Controller –ModelTypeWorkOrder –ControllernameWorkOrderController – DbContextTypeWorkOrder – Repository -Force
  • Everything revolves arround command lineImportant to not only understand but also to know what’s availableSwitch = booleans – false by default, it’s pressence implies setting to true (basic Power Shell functionality)Options
  • Get-ModuleGet-Command –Module T4ScaffoldingGet-Alias ScaffoldGet-Help Invoke –Scaffolder (abreviated list, just the basic command options, use TAB to see all the options)Scaffold [tab]Controller –[tab]Scaffold [tab]View –[tab]
  • Customizing templates
  • ScaffoldMvcScaffolding.ActionWithUnitTest –Controller WorkOrderController –Action ArchiveWorkOrder –ViewModelWorkOrderCustomizingScaffold CustomTemplateViewIndexShow the CodeTemlate folder with T4 fileFind ModelProperty and add “DisplayName”Add new method GetDisplayName()PM&gt; Scaffold Controller –ModelTypeWorkOrder –ControllernameWorkOrderController – DbContextTypeWorkOrder – Repository -Force
  • Jay has shown you
  • Jay has shown you
  • MVC Scaffolding Made Easy

    1. 1. http://geekswithblogs.net/mradradacz.mcp@gmail.com
    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. http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/http://mvcscaffolding.codeplex.com/http://webapiscaffolding.codeplex.com/http://geekswithblogs.net/michelotti
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×