SlideShare a Scribd company logo
1 of 24
Download to read offline
More object oriented development with Page Type Builder -or how to have a little more fun at work
Agenda Problems with the standard EPiSevermodel How Page TypeBuildersolves the problems How to use Page TypeBuilder Questions
The EPiServer Model PageType Is, sort of, an  instance of Decideswhich template to use PageData Page (.ASPX) Renderscontent from
Deardiary, today I… …created Page Types
Deardiary, today I… …addedproperties
Deardiary, today I… …addedmarkup to display properties
Deardiary, today I… …wrotesomecode
Deardiary, today I… …did a release
A few problems Wespend a lot of time not writingcode Wedefine ”templates” for objects in a webbased UI There’s no inheritancebetween page types Synchronizing different environments is a pain ObjectOrientation? Weuse a lot of ”magic strings” Weplacelogic in the presentation layer that doesn’tnecessarilybelongthere WedistinguishPageDataobjects by the ID of their Page Type
Whatif… Article Decideswhich template to use Actually is an instance of ArticlePage Page<Article> (.ASPX) Renderscontent from, knowing the type
Page TypeBuilder An opensourceproject Creates and updates page typesbased on classes Ensures that DataFactoryreturnsinstances of your classes
By using Page TypeBuilderwe get Less switchingbetween Visual Studio and Admin Inheritancebetween page types Stronglytyped access to properties The ability to placelogic in pages Polymorphism Faster and easier releases Bettertestability
Getting started Download from pagetypebuilder.codeplex.com ReferencePageTypeBuilder.dll CopyCastle.Core.dll and Castle.DynamicProxy2.dll to your bin folder
Creating a page type usingPageTypeBuilder; namespaceMySite.PageTypes { [PageType] public classArticle : TypedPageData     {     } }
Specifying settings [PageType( Filename ="/Templates/Article.aspx”, DefaultChildSortOrder =FilterSortOrder.Index)] public classArticle : TypedPageData { }
Addingproperties [PageType] public classArticle : TypedPageData { 	[PageTypeProperty] public virtual stringMainBody { get; set; } }
Specifyingproperty settings [PageType] public classArticle : TypedPageData { 	[PageTypeProperty( EditCaption ="Main body", HelpText = "Will be shown in the main content area of the page", Type = typeof(PropertyXhtmlString))] public virtual stringMainBody { get; set; } }
Creating a template usingPageTypeBuilder.UI; namespaceMySite.Templates { public partialclassArticle : TemplatePage<PageTypes.Article>     {     } }
Creating a template <%@ PageLanguage="C#"CodeBehind="Article.aspx.cs" Inherits="MySite.Templates.Article" MasterPageFile="~/Templates/MasterPages/MasterPage.master"%> <asp:ContentContentPlaceHolderID="MainBodyRegion"runat="server"> <%= CurrentPage.MainBody%> </asp:Content>
Addlogic to properties [PageTypeProperty(Type = typeof(PropertyString))] public string Heading { 	get { 	      string heading= this.GetPropertyValue(page => page.Heading); 	      if (!string.IsNullOrEmpty(heading)) 	          return heading; 	      return PageName; } }
Addingmethods to page types [PageType] public classArticle : TypedPageData {       publicIEnumerable<Comment> GetComments()       { return DataFactory.Instance.GetChildren(PageLink)                         .OfType<Comment>();       } }
DependencyInjection [PageType] public classArticle : TypedPageData { privateIPageSourcedataFactory; public Article(IPageSourcedataFactory) { this.dataFactory = dataFactory; }       publicIEnumerable<Comment> GetComments()       { returndataFactory.GetChildren(PageLink)                         	.OfType<Comment>();       } }
Where to learnmore pagetypebuilder.codeplex.com ,[object Object]
Links to 40+ blog posts,[object Object]

More Related Content

What's hot

Office 2013 loves web developers slide
Office 2013 loves web developers   slideOffice 2013 loves web developers   slide
Office 2013 loves web developers slideFabio Franzini
 
Active Server Page(ASP)
Active Server Page(ASP)Active Server Page(ASP)
Active Server Page(ASP)Keshab Nath
 
Industrial training seminar ppt on asp.net
Industrial training seminar ppt on asp.netIndustrial training seminar ppt on asp.net
Industrial training seminar ppt on asp.netPankaj Kushwaha
 
Sviluppare app per office
Sviluppare app per officeSviluppare app per office
Sviluppare app per officeFabio Franzini
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web appsIvano Malavolta
 
Active server pages
Active server pagesActive server pages
Active server pagesmcatahir947
 
Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...Fabio Franzini
 
tTecniche di sviluppo mobile per share point 2013 e office 365
tTecniche di sviluppo mobile per share point 2013 e office 365 tTecniche di sviluppo mobile per share point 2013 e office 365
tTecniche di sviluppo mobile per share point 2013 e office 365 Fabio Franzini
 
Web components
Web componentsWeb components
Web componentsNoam Kfir
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkImam Raza
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideMark Rackley
 
Bridging the Gap: Single-Page Apps and AEM
Bridging the Gap: Single-Page Apps and AEMBridging the Gap: Single-Page Apps and AEM
Bridging the Gap: Single-Page Apps and AEMrbl002
 
Your First ASP_Net project part 1
Your First ASP_Net project part 1Your First ASP_Net project part 1
Your First ASP_Net project part 1Biswadip Goswami
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMAdobeMarketingCloud
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011David Carr
 
Creating a Data Driven UI Framework
Creating a Data Driven UI FrameworkCreating a Data Driven UI Framework
Creating a Data Driven UI FrameworkAnkur Bansal
 

What's hot (20)

Office 2013 loves web developers slide
Office 2013 loves web developers   slideOffice 2013 loves web developers   slide
Office 2013 loves web developers slide
 
Asp net
Asp netAsp net
Asp net
 
Active Server Page(ASP)
Active Server Page(ASP)Active Server Page(ASP)
Active Server Page(ASP)
 
Industrial training seminar ppt on asp.net
Industrial training seminar ppt on asp.netIndustrial training seminar ppt on asp.net
Industrial training seminar ppt on asp.net
 
Sviluppare app per office
Sviluppare app per officeSviluppare app per office
Sviluppare app per office
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web apps
 
Active server pages
Active server pagesActive server pages
Active server pages
 
Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...
 
Apex & jQuery Mobile
Apex & jQuery MobileApex & jQuery Mobile
Apex & jQuery Mobile
 
Introduction to asp
Introduction to aspIntroduction to asp
Introduction to asp
 
tTecniche di sviluppo mobile per share point 2013 e office 365
tTecniche di sviluppo mobile per share point 2013 e office 365 tTecniche di sviluppo mobile per share point 2013 e office 365
tTecniche di sviluppo mobile per share point 2013 e office 365
 
Web components
Web componentsWeb components
Web components
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
 
Bridging the Gap: Single-Page Apps and AEM
Bridging the Gap: Single-Page Apps and AEMBridging the Gap: Single-Page Apps and AEM
Bridging the Gap: Single-Page Apps and AEM
 
Learn ASP
Learn ASPLearn ASP
Learn ASP
 
Your First ASP_Net project part 1
Your First ASP_Net project part 1Your First ASP_Net project part 1
Your First ASP_Net project part 1
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
Creating a Data Driven UI Framework
Creating a Data Driven UI FrameworkCreating a Data Driven UI Framework
Creating a Data Driven UI Framework
 

Viewers also liked

Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Developmentjoelabrahamsson
 
En introduktion till SOLID-principerna
En introduktion till SOLID-principernaEn introduktion till SOLID-principerna
En introduktion till SOLID-principernajoelabrahamsson
 
The Total Book Developing Solutions With EPiServer 4
The Total Book Developing Solutions With EPiServer 4The Total Book Developing Solutions With EPiServer 4
The Total Book Developing Solutions With EPiServer 4Martin Edenström MKSE.com
 
Automated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS SitesAutomated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS Sitesjoelabrahamsson
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldabaux singapore
 

Viewers also liked (7)

Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Development
 
En introduktion till SOLID-principerna
En introduktion till SOLID-principernaEn introduktion till SOLID-principerna
En introduktion till SOLID-principerna
 
The Total Book Developing Solutions With EPiServer 4
The Total Book Developing Solutions With EPiServer 4The Total Book Developing Solutions With EPiServer 4
The Total Book Developing Solutions With EPiServer 4
 
Automated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS SitesAutomated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS Sites
 
EPiServer Deployment Tips & Tricks
EPiServer Deployment Tips & TricksEPiServer Deployment Tips & Tricks
EPiServer Deployment Tips & Tricks
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 

Similar to More fun object oriented development with Page Type Builder

Templates
TemplatesTemplates
Templatessoon
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...SPTechCon
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentRob Windsor
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05Vivek chan
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
Building Your First Store App with XAML and C#
Building Your First Store App with XAML and C#Building Your First Store App with XAML and C#
Building Your First Store App with XAML and C#Tamir Dresher
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizationsChris Love
 
SharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentialsSharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentialsMark Rackley
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentationsasidhar
 
d.mix: Programming by a Sample
d.mix: Programming by a Sampled.mix: Programming by a Sample
d.mix: Programming by a SampleLeslie W
 
Decoding the Web
Decoding the WebDecoding the Web
Decoding the Webnewcircle
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulationborkweb
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
 

Similar to More fun object oriented development with Page Type Builder (20)

Templates
TemplatesTemplates
Templates
 
Javascript projects Course
Javascript projects CourseJavascript projects Course
Javascript projects Course
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
Building Your First Store App with XAML and C#
Building Your First Store App with XAML and C#Building Your First Store App with XAML and C#
Building Your First Store App with XAML and C#
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Master page
Master pageMaster page
Master page
 
SharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentialsSharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentials
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
d.mix: Programming by a Sample
d.mix: Programming by a Sampled.mix: Programming by a Sample
d.mix: Programming by a Sample
 
Decoding the Web
Decoding the WebDecoding the Web
Decoding the Web
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 

Recently uploaded

Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 

Recently uploaded (20)

Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 

More fun object oriented development with Page Type Builder

  • 1. More object oriented development with Page Type Builder -or how to have a little more fun at work
  • 2. Agenda Problems with the standard EPiSevermodel How Page TypeBuildersolves the problems How to use Page TypeBuilder Questions
  • 3. The EPiServer Model PageType Is, sort of, an instance of Decideswhich template to use PageData Page (.ASPX) Renderscontent from
  • 4. Deardiary, today I… …created Page Types
  • 5. Deardiary, today I… …addedproperties
  • 6. Deardiary, today I… …addedmarkup to display properties
  • 7. Deardiary, today I… …wrotesomecode
  • 8. Deardiary, today I… …did a release
  • 9. A few problems Wespend a lot of time not writingcode Wedefine ”templates” for objects in a webbased UI There’s no inheritancebetween page types Synchronizing different environments is a pain ObjectOrientation? Weuse a lot of ”magic strings” Weplacelogic in the presentation layer that doesn’tnecessarilybelongthere WedistinguishPageDataobjects by the ID of their Page Type
  • 10. Whatif… Article Decideswhich template to use Actually is an instance of ArticlePage Page<Article> (.ASPX) Renderscontent from, knowing the type
  • 11. Page TypeBuilder An opensourceproject Creates and updates page typesbased on classes Ensures that DataFactoryreturnsinstances of your classes
  • 12. By using Page TypeBuilderwe get Less switchingbetween Visual Studio and Admin Inheritancebetween page types Stronglytyped access to properties The ability to placelogic in pages Polymorphism Faster and easier releases Bettertestability
  • 13. Getting started Download from pagetypebuilder.codeplex.com ReferencePageTypeBuilder.dll CopyCastle.Core.dll and Castle.DynamicProxy2.dll to your bin folder
  • 14. Creating a page type usingPageTypeBuilder; namespaceMySite.PageTypes { [PageType] public classArticle : TypedPageData { } }
  • 15. Specifying settings [PageType( Filename ="/Templates/Article.aspx”, DefaultChildSortOrder =FilterSortOrder.Index)] public classArticle : TypedPageData { }
  • 16. Addingproperties [PageType] public classArticle : TypedPageData { [PageTypeProperty] public virtual stringMainBody { get; set; } }
  • 17. Specifyingproperty settings [PageType] public classArticle : TypedPageData { [PageTypeProperty( EditCaption ="Main body", HelpText = "Will be shown in the main content area of the page", Type = typeof(PropertyXhtmlString))] public virtual stringMainBody { get; set; } }
  • 18. Creating a template usingPageTypeBuilder.UI; namespaceMySite.Templates { public partialclassArticle : TemplatePage<PageTypes.Article> { } }
  • 19. Creating a template <%@ PageLanguage="C#"CodeBehind="Article.aspx.cs" Inherits="MySite.Templates.Article" MasterPageFile="~/Templates/MasterPages/MasterPage.master"%> <asp:ContentContentPlaceHolderID="MainBodyRegion"runat="server"> <%= CurrentPage.MainBody%> </asp:Content>
  • 20. Addlogic to properties [PageTypeProperty(Type = typeof(PropertyString))] public string Heading { get { string heading= this.GetPropertyValue(page => page.Heading); if (!string.IsNullOrEmpty(heading)) return heading; return PageName; } }
  • 21. Addingmethods to page types [PageType] public classArticle : TypedPageData { publicIEnumerable<Comment> GetComments() { return DataFactory.Instance.GetChildren(PageLink) .OfType<Comment>(); } }
  • 22. DependencyInjection [PageType] public classArticle : TypedPageData { privateIPageSourcedataFactory; public Article(IPageSourcedataFactory) { this.dataFactory = dataFactory; } publicIEnumerable<Comment> GetComments() { returndataFactory.GetChildren(PageLink) .OfType<Comment>(); } }
  • 23.
  • 24.

Editor's Notes

  1. Three of the mostimportantcomponentswhendeveloping with EPiServer is Page Types, PageDataobjects and templates.A PageDataobject is sort of an instance of a PageType. A PageType is sort of like class, but not quite. Let’stake a look at whatimplications this has for oureveryday work.
  2. Wecreate page types in EPiServer’sadmin mode.
  3. Weaddproperties to page types, again in EPiServer’sadmin mode.
  4. Weaddmarkup to pages and usercontrols, oftenusingwebcontrols that ship with EPiServer, to display the properties.
  5. Whenweneedsomecustombehaviorweadd it to pages,customcontrols or some sort of utilityclasses.
  6. Althoughweuse a staticallytypedlanguageweuse a lot of magic strings and therebybypass the checks performed by the compiler.It can be discussed, but I personallydon’tthink that determiningwhat to display as a heading for a page is the presentation layer’sjob, it’s the page’s.Since all pages are just instance of PageDatawehave to rely on filtering by numericalID’swhenwewant to find pages of a certain page type. This is extra problematicwhenwewant pages that may be of several different page typessincethere’s no inheritancebetween page types and theycan’timplement interfaces.
  7. What if each page type was actually a class? And whatifeachPageDataobjectwas an instance of that class? And whatif the templateknewwhichtype, or basetype, it was rendering?If that was the casewewouldhaveinheritancebetween page types. Wecouldstrongly access propertyvalues. And wecouldeasily filter pages not only by typebutalso by whetherit’stypeimplements an interface or not.
  8. Page TypeBuildersolves this (the previousslide).Page TypeBuilderdoesquite a lot of things, but the twomostimportantthings is that it creates and updates page typebased on classes that we, or third party products, candefine and that it interceptsrequests for PageDataobjects to DataFactory’smethods and replaces the objects that theyreturn with instances of the class that defines the page’s page type.
  9. As wedefine page types in code all wehave to do to add or update page types, properties and tabs is writecode, compile and go to the site.As classes are used to define page typesweeffectively get inheritancebetween page types.SinceDataFactorynowreturnsinstances of ourclasseswe get stronglytyped access to propertyvalues.Another benefit of DataFactoryreturninginstances of ourclassesinstead of just PageData is that wecanplacelogic in theseclasses. I’llsoon show a couple of example of how this can work.Aseach page is an instance of a class that canhaveit’sownspecificbehaviour and alsoimplement interfaces wecanusepolymorphism. That is several page typescanhave the same method with the same signature that is implemented in different ways. Wecanthenusecode that is uses this methodbutdoesn’tknowaboutit’simplementation.Since Page TypeBuilderadds and updates page types, properties and tabs all wehave to dowhenwewantneed to do a release that involves page typechanges is to deployourassemblies.The moreobjectorientedway of working with Page TypeBuildercan a cornerstone in writingcode that it’spossible to writeunit tests for. Page TypeBuilderalso offers a moreconcreteadvantagewhen it comes to testing. Sincewecanmovesomelogic from the hard-to-test presentation layerintoour page typeclasses, and Page TypeBuilder has a feature for injectingdependenciesintoPageDataobjectswecanputquiteeasily test it.
  10. I’veputsomeeffortintomaking it as easy as possible to get started with Page TypeBuilder. This meansthere’s no configuration or installationrequired. All you have to do is download it and put the assemblies that the Zipfilecontainsinto your bin folder and add a reference to PageTypeBuilder.dll.Of course, in a realistic scenario you wouldprobablywant to putthird party libraries like this somewhereelse and havethemautomaticallycopied to your bin folder when you compile. In that case you need to ensure that the two Castle assemblies are copied to the bin folder as Page TypeBuilder is dependent on them.PageTypeBuilderrequires EPiServer CMS 5 R2 SP2 or EPiServer CMS 6.
  11. To create a page type all you have to do is add a new class in your project that inherits from TypedPageData and has a PageTypeattribute. Given thesefewlines of code Page TypeBuilderwillcreate a new page typenamedArticle as soon as you compile and browse the site.Normallywhenwecreate a page typewehave to specify a fewthingssuch as a path to the template that shouldrender the page type. Page TypeBuilderdoesn’t force us to do this and instead has a fewconventions. For instance, ifwedon’tspecify a path to the template it willautomatically be set to default.aspx.
  12. By setting properties on the PageTypeattributewecanspecifyevery setting for a page type that wecanspecify in EPiServer’sadmin mode.By default the name of the page typewill be the class’ namebutwecanspecify that as wellusing the PageTypeproperty. Be awarethough that the name is used to identify the page type.
  13. Tocreateproperties all wehave to do is add a codeproperty to a page typeclass and add a PageTypePropertyattribute to it.Again Page TypeBuilderwilluseit’s default conventions for mandatory settings. For instance, codeproperties of type string willautomatically be created as XHTML string properties.
  14. Just as for page typeswecanuseproperties of the PageTypePropertyattribute to specifyeverything that wecanspecify in admin mode. However, it does not handle the new property settings that wasintroduced in EPiServer CMS 6. At least not yet.
  15. Oncewehave a page typewewillprobablywant to render it using a template. Creating templateswhenusing Page TypeBuilder is verysimillar to how you do it when you aren’tusing Page TypeBuilder. The onlydifference, which is optional, is that you inherit from Page TypeBuilder’sgenericTemplatePage, or UserControllBase, instead of the EPiServer equivalents. These in turninherit from EPiServer’sclasses with the same name so no functionality is lost.
  16. By inheriting from Page TypeBuildersgenericbaseclasses for pages or usercontrols the CurrentPagepropertywill be of the specifiedtype, enablingstronglytyped access to the currentpage’sproperties.
  17. Previouslywesaw a verybasicimplementation of a propertyusingautomatic getters and setters. Wecanalsoimplementpropertiesusing an extension method for PageDatanamedGetPropertyValue. This waywecancreateproperties with logic in them. In this casewe check if the headingproperty is set and return it if it is. If it isn’twereturn the page’sname. This waywhenwewant to display a heading for the page wedon’thave to createanyconditionallogic, just display the page’sHeadingcodeproperty. This wayweencapsulate data where it belong and we get less code repetition.
  18. AsDataFactorynowreturnsinstances of ourclasseswecan not just addlogic to properties. Wecanalsoaddregularmethods to our page types.This exampleillustratestwothings. First of all that wecanadd a methodsuch as GetComments to ourArticle page typeclass. Second that wecan filter pages by type.In a real scenarioweprobablywouldn’twant to callDataFactory.Instance from the methodbutinject an instance of an interface into the object.