SlideShare uma empresa Scribd logo
1 de 46
Use T4 to apply
Domain Specific Development
Joubin Najmaie (@joubin)
Senior Solution Architect
PageFragments.com
joubin.najmaie@gmail.com
Agenda
• Domain Specific Development – quick concepts
• Quick story behind it all
• Project overview
• Break
• Review and Recap
• T4 overview
All Resources and Links
http://www.joubin.ca
60,000 Foot View
• Our typical project iterations
50,000 Foot View
• Domain Specific
Development approach
• (If applicable)
40,000 Foot View
• Work in terms of the problem space
• Makes it more accessible
• people not familiarwith the problem space
• Models - more verifiable and updatable
• Business knowledge is captured once
• DSL could be updated
30,000 Foot View
• Framework
• DSL – variable
20,000 foot view
• Domain-specific languages (DSLs)
• Text-based
• Code, XML, sql, wsdl, documentation etc.
• Graphical
• Flowcharts, ERDs, state diagrams, Venn diagrams
10,000 foot view
• T4
• Engine to create text-based DSLs
• Visual Studio
• 2005 -GAT toolkits
• 2008 - Downloadable DSL toolkit
• 2010 - Integrated part
5000 foot view
• Generates code from described models
• Models could be
• Metadata
• Configuration
• Database
One Story Behind our Project
• Our “suit” calls a meeting
• Empower the business users
• Give control over their own content
• Decentralize responsibilities
• Take “work” out
• By giving control over their content
Run Back to Your Desk
Content Analysis and Req’t Gathering
Code and Code more
Moment of Realization
• You’re doing the same thing every time you want
to be able to content manage a portion of the site
Project Walkthrough
PageFragments
Review & Recap
• Create a Special Purpose Language
• Capture of Domain knowledge
• Accessible to more developers
• Ability to build upon models
• Model is verifiable
• Domain Specific API for easy manipulation
• Flexibility: DSL could be in any language
What is T4?
• Text Template
Transformation Toolkit
• A templated text
generation engine
T4 Usage In Visual Studio
• ASP
.NET MVC
• Visual Studio Item templates
• Visual Studio Project templates
T4 Structure
• An overview of the T4 anatomy
• Processing a Template
Text-template
• Extension: .tt
• Item templates:
• Text Template
• Preprocessed text template
• Default transformation tools in Visual Studio
• TextTemplatingFileGenerator
• TextTemplatingFilePreprocessor
• In order to deploy/publish
• Build Action: Content
Anatomy of a Text-Template
How a Text-Template is Processed
Generate Class Based On an XSD
Let’s Get Into The T4 Syntax
• An overview of the T4 syntax
• Processing directives
• T4 various blocks
Processing Directives
Similar to ASPX or ASCX directive syntax
<#@ and end with #>
Directives
template
assembly
import
output
include
Processing Directive - template
<#@ template debug="true" language="C#" #>
Parameters
debug
language
inherits
hostspecific
Processing Directive - assembly
<#@ assembly #>
Parameter
name
could be an assembly in the GAC
• <#@ assembly name=“System.Data” #>
or absolute path to the assembly
• <#@ assembly name=“c:projectsproj1bindebugproj1.dll” #>
Processing Directive - import
<#@ import #>
Parameter
namespace
<#@ import namespace=“System.Collections.Generic” #>
Processing Directive - include
<#@ include #>
Parameter
file
<#@ include file=“includefile.tt” #>
Processing Directives
T4 Syntax
• Processing directives
• T4 various blocks
Text Blocks
Non-programmatic text
Statement Blocks
Delineated using <# #>
Expression Blocks
Delineated using <#= #>
Class Feature Blocks
Delineated using: <#+ #>
Used to add any class level construct
Helper functions
Fields
Constants
Properties
Code Blocks
Debugging a Text Template
Compile and Generate Assembly
Visual Studio – support tools
• Plug-in by Tangible Engineering *
• http://bit.ly/dfFhEi
• T4 Editor by Clarius
• http://bit.ly/cHfGRn
Call to action
• Try out the Text Template item template
• Start thinking of scenarios where you can apply
Domain Specific Development
• Look at other solutions that have used this
development pattern
• Many on Codeplex
Resources
• All resource links: http://www.joubin.ca
• T4 Templates: A Quick-Start Guide for ASP
.NET
MVC Developers
• http://bit.ly/cVKYp5
• Code gen + text template: http://bit.ly/VYsFf
• Glossary of terms: http://bit.ly/9gZosy
• Oleg’s blog: http://bit.ly/cq13qq
Resources
• Language Oriented Programming: The Next
Programming Paradigm:
• http://bit.ly/bVqYoG
• Book: Domain-Specific Development with
Visual Studio DSL Tools
• ISBN: 0321398203
Evaluations and Feedback
• Please fill out your evaluations!
Thank you!
And thanks to our sponsors
Send T4 questions to:
• Joubin Najmaie
• Twitter: @joubin
• Email: joubin.najmaie@gmail.com
• Blog: http://joubin.ca

Mais conteúdo relacionado

Mais procurados

.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel ZikmundKarel Zikmund
 
Onion Architecture and the Blog
Onion Architecture and the BlogOnion Architecture and the Blog
Onion Architecture and the Blogbarryosull
 
Translate word press to your language
Translate word press to your languageTranslate word press to your language
Translate word press to your languagembigul
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIOliver Busse
 
Continuous integration
Continuous integrationContinuous integration
Continuous integrationLior Tal
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXSergei Martens
 
.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло ГолубовичSigma Software
 
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormationTear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormationJames Andrew Vaughn
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basicsGraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basicsVisuality
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel ZikmundKarel Zikmund
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel ZikmundKarel Zikmund
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel ZikmundKarel Zikmund
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFxThomas Daly
 
SharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx ExtensionsSharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx ExtensionsAnupam Ranku
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#NguynSang29
 
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel ZikmundDotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel ZikmundKarel Zikmund
 

Mais procurados (20)

.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
Onion Architecture and the Blog
Onion Architecture and the BlogOnion Architecture and the Blog
Onion Architecture and the Blog
 
Translate word press to your language
Translate word press to your languageTranslate word press to your language
Translate word press to your language
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEX
 
.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович
 
.Net standard 2.0
.Net standard 2.0.Net standard 2.0
.Net standard 2.0
 
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormationTear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basicsGraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basics
 
.Net Fundamentals
.Net Fundamentals.Net Fundamentals
.Net Fundamentals
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
 
SharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx ExtensionsSharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx Extensions
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
 
Using PowerShell for SharePoint 2013
Using PowerShell for SharePoint 2013Using PowerShell for SharePoint 2013
Using PowerShell for SharePoint 2013
 
Client server
Client serverClient server
Client server
 
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel ZikmundDotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
 

Semelhante a Domain Specific Development using T4

Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSThomas Daly
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection NavigationThomas Daly
 
Innovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and FrameworkInnovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and FrameworkSandeep Adwankar
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation PortalSteve Anderson
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2Mike Willbanks
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET PlatformAlex Thissen
 
Markup languages and warp-speed documentation
Markup languages and warp-speed documentationMarkup languages and warp-speed documentation
Markup languages and warp-speed documentationLois Patterson
 
Lois Patterson: Markup Languages and Warp-Speed Documentation
Lois Patterson:  Markup Languages and Warp-Speed DocumentationLois Patterson:  Markup Languages and Warp-Speed Documentation
Lois Patterson: Markup Languages and Warp-Speed DocumentationJack Molisani
 
Effective admin and development in iib
Effective admin and development in iibEffective admin and development in iib
Effective admin and development in iibm16k
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )Rajput Rajnish
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)Gerke Max Preussner
 
Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?Jeff Bramwell
 
Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsVagif Abilov
 

Semelhante a Domain Specific Development using T4 (20)

Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection Navigation
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
 
Innovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and FrameworkInnovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and Framework
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation Portal
 
T4 presentation
T4 presentationT4 presentation
T4 presentation
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
 
Markup languages and warp-speed documentation
Markup languages and warp-speed documentationMarkup languages and warp-speed documentation
Markup languages and warp-speed documentation
 
Lois Patterson: Markup Languages and Warp-Speed Documentation
Lois Patterson:  Markup Languages and Warp-Speed DocumentationLois Patterson:  Markup Languages and Warp-Speed Documentation
Lois Patterson: Markup Languages and Warp-Speed Documentation
 
O365: Attack of the Clones
O365: Attack of the ClonesO365: Attack of the Clones
O365: Attack of the Clones
 
Effective admin and development in iib
Effective admin and development in iibEffective admin and development in iib
Effective admin and development in iib
 
Ow
OwOw
Ow
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
 
Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?
 
Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable Specifications
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
Ow
OwOw
Ow
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Domain Specific Development using T4

Notas do Editor

  1. Main concepts of DSD Demo project features
  2. 1) A task/project/problem in hand 2) Pick favorite general purpose language – C#, VB.NET 3) Deliver project Each occurrence of problem has many aspects that are the same everytime (fixed part) And other aspects that are differs each time – variable part We’re going to automatically generate code for the variable part of the solution. Fixed part – We’ll treat as the framework Variable aspect – fits into the framework itself On a current project: Fixed aspect: Web Asset and configuration management framework Variable aspect: The content models (or aka content types in SharePoint) The content types: defined as metadata in a database, configuration file etc. T4 templates run to generate special classes (and logic) for the specific content types. The generated code could then be embedded in VS.NET projects (code or assembly) or called dynamically on the server to retrieve data. Other examples: ORM software Language-oriented programming Basis – observation Instead of solving problem one-at-a-time Many problems can more easily be resolved by designing a special-purpose language Code generation – through DSL toolkit with VS.NET Use T4 to generate that specialized programming language
  3. 1) A task/thought/problem in hand 2) Create/Pick a special-purpose language 3) Use a general purpose lang to write framework 4) Deliver project
  4. -- Benefits Ability to work in terms of the problem space Working in terms of the model of the problem space makes it more accessible to people not familiar with the problem space You can have the domain-experts verify the correctness of your model independently The model itself should be more testable and used to simulate scenarios Once the business knowledge is captured, the DSL could be updated to use other technologies, for example, by modifying the generator
  5. Framework – use general-purpose languages The variable pieces –generate domain-specific languages Plug the generated domain-specific languages into the framework
  6. DSL = “custom language that targets a small problem domain, which it describes and validates in terms native to the domain.” Could be seen as a set of tools to build tools Focus: text-based only!
  7. T4 - Engine to create text-based DSLs Visual Studio.NET 2005 - GAT toolkits 2008 - Downloadable DSL toolkit 2010 - Integrated part
  8. Generates code from described models Models could be Metadata Configuration Database What does it stand for? What are the Inputs? What are the outputs? What does the syntax look like? What are the supported languages?
  9. T3 == Text-to-Text Transformation T4 == Text Template Transformation Toolkit A tool in the VS.NET DSL toolkit A text-based code generation engine Templates = syntax similar to ASPX or ASCX Support: C# and VB.NET
  10. VS.NET extensibility
  11. .tt Pre 2010 – text file – turn it into .tt 2010 – two kinds of item templates Default transformation tools – properties of a tt file Publishing: Build Action to Content
  12. ASP.NET-like syntax Processor directives: compilation options Blocks: Mixture of text, control logic, blocks of executable code
  13. Base class: Microsoft.VisualStudio.TextTemplating.TextTransformation Directives Assemblies are loaded Include files are imported Text and expression blocks: Copied to the TransformText method Class-feature blocks: Copied at the class level T4 engine – calls the “TransformText” method – entry point %TEMP% folder
  14. This demo will be the basis for all Syntax reviewed here.
  15. Provide instructions to the T4 engine Just like ASPX pages: <#@ and end with #> Directives template assembly import output include
  16. Characteristics of the transformed output Debug --- true/false True – you can take a look files in system %TEMP% folder Language: Values: C#, VB, C#3.5 Inherits Base class: Microsoft.VisualStudio.TextTemplating.TextTransformation Tells which base class to use Hostspecific --- true/false Mostly used to output template file name to the transformed file Host.TemplateFile Host.StandardAssemblyReferenes
  17. “Add reference” in VS.NET One parameter name could be an assembly in the GAC <#@ assembly name=“System.Data” #> or absolute path to the assembly <#@ assembly name=“c:\projects\proj1\bin\debug\proj1.dll” #>
  18. Equivalent to: C# using VB.NET import One parameter namespace
  19. File to be included verbatim in template One parameter File Can contain any of the valid T4 constructs Relative paths -- to the main template
  20. Had an overview of the processing directives Let’s talk about T4 block types
  21. Just type directly into the .tt file Copied directly to TransformText method %TEMP% Show generated file
  22. Control the flow of processing in TransformText method Example usage: To conditionally output Text blocks Iterate over data and output things conditionally
  23. Use to add strings to the output file Added, in sequence To the “TransformText” method with calls to the ToString() method Used in cases to change some aspect of the generated output text file to use Calculated values External data e.g. database column values some other calculated value in a Statement block somewhere else in the .TT file.   C# – could be multiple lines VB.NET – single lines only
  24. Any class-level construct Helper functions Fields Constants Properties any construct that is valid at the class level T4 allows the usage of text and expression blocks intermingled with class feature blocks The helper method would be called from within a Statement block.
  25. Text template - %TEMP% Preprocessed: uses TextTemplatingFilePreprocessor transformation tool Debugging: System.Diagnostics.Debugger.Launch();
  26. DO NOT REMOVE THIS SLIDE