SlideShare ist ein Scribd-Unternehmen logo
1 von 25
http://geekswithblogs.net/mrad
radacz.mcp@gmail.com
…generate “starter” code…

…provide a extensibility mechanism to customize
generated code…

…generate more than just MVC Controllers and
Views…
Install-Package MvcScaffolding



Scaffold Controller Product
Invoke-Scaffolder



   “Scaffold” Alias


       scaffoldingTabExpansion
       (context command line switch)
Action       • MvcScaffolding.Action

  Controller     • MvcScaffolding.Controller

CustomScaffold   • T4Scaffolding.CustomScaffolder

CustomTemplate   • T4Scaffolding.CustomTemplate

  DbContext      • T4Scaffolding.EFDbContext

  Repository     • T4Scaffolding.EFRepository

   UnitTest      • MvcScaffolding.ActionUnitTest

    View         • MvcScaffolding.RazorView

    Views        • MvcScaffolding.Views
Get-DefaultScaffolder Controller

Set-DefaultScaffolder Controller MvcScaffolding.ControllerWithRepository
Action:
Scaffold Action -Controller TasksController -Action Foo -ViewModel Task

Unit Test:
Scaffold UnitTest -Controller TasksController -Action Create

Both in 1 shot:
Scaffold MvcScaffolding.ActionWithUnitTest -Controller TasksController -Action
ArchiveTask -ViewModel Task
Scaffold CustomTemplate <ScaffolderName> <TemplateName>

Scaffold CustomTemplate View Index
Add-                            Add-
 Add-ClassMember                                                                         Find-ScaffolderTemplate            Get-DefaultScaffolder
                            ClassMemberViaTemplate        ProjectItemViaTemplate




                                                                   Get-
Get-PluralizedWord              Get-PrimaryKey                                               Get-ProjectFolder                Get-ProjectItem
                                                         ProjectAspNetMvcVersion




Get-ProjectLanguage             Get-ProjectType             Get-RelatedEntities               Get-Scaffolder                Get-SingularizedWord




                Invoke-Scaffolder          Invoke-ScaffoldTemplate         Set-DefaultScaffolder               Set-IsCheckedOut
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://mvcscaffolding.codeplex.com/

http://webapiscaffolding.codeplex.com/

http://geekswithblogs.net/michelotti

Weitere ähnliche Inhalte

Andere mochten auch

Chỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấp
Chỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấpChỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấp
Chỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấpkimthoa3124
 
Nikko 1650
Nikko 1650Nikko 1650
Nikko 1650k0rb3n
 
CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39
CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39
CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39kimthoa3124
 
Creating Discounts & Promotions with Hitachi Solutions Ecommerce
Creating Discounts & Promotions with Hitachi Solutions EcommerceCreating Discounts & Promotions with Hitachi Solutions Ecommerce
Creating Discounts & Promotions with Hitachi Solutions EcommerceHitachi Solutions America, Ltd.
 

Andere mochten auch (6)

Chỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấp
Chỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấpChỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấp
Chỉ 307tr sở hữu ngay căn hộ tại trung tâm gò vấp
 
Nikko 1650
Nikko 1650Nikko 1650
Nikko 1650
 
CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39
CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39
CĂN HỘ SUNVIEW 3 TRUNG TÂM GÒ VẤP 614TR/CĂN LH 09815 45 75 39
 
Emails in Hitachi Solutions Ecommerce
Emails in Hitachi Solutions EcommerceEmails in Hitachi Solutions Ecommerce
Emails in Hitachi Solutions Ecommerce
 
English
EnglishEnglish
English
 
Creating Discounts & Promotions with Hitachi Solutions Ecommerce
Creating Discounts & Promotions with Hitachi Solutions EcommerceCreating Discounts & Promotions with Hitachi Solutions Ecommerce
Creating Discounts & Promotions with Hitachi Solutions Ecommerce
 

Kürzlich hochgeladen

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Kürzlich hochgeladen (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

MVC Scaffolding Made Easy

Hinweis der Redaktion

  1. “…it doesn’t generate code that suits my project.”“…the code is not complete enough for Production use.”“…I have a non-MVC project
  2. 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
  3. 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
  4. 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]
  5. Customizing templates
  6. 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
  7. Jay has shown you
  8. Jay has shown you