SlideShare a Scribd company logo
1 of 15
Using the Kentico CMS API
Thom Robbins (thomasr@kentico.com
Bryan Soltis (bryan@bitwizards.com)
Agenda
• Overview (Architecture/Objects) (Thom)
• CMS Context (Bryan)
• Document Management (Thom)
• Global Events (Thom)
• Modules (Bryan)
Looking at Kentico CMS
Logical three tier architecture…
Architecture breakdown
Data layer
(+metadata)
Business layer
Controls libraries
UI components
Web project pages Live site pages +
admin UI pages
Web parts + User
controls
CMSControls
Helpers
SettingsProvider
Enumerations Infos & Providers
Data engine
GeneralConnection
Abstract info
Metadata infos
(Class, Query,
SettingsKey)
Interfaces
Third party code
Module web parts
+ Module user
controls
Module controls
Module Infos &
Providers
Module definitions
Presentationlayer
Best Practice Tip
• Kentico CMS web site project provides examples of all sorts of code!
OO Basics - Object Creation Examples
// Create UserInfo
CMS.SiteProvider.UserInfo user = new CMS.SiteProvider.UserInfo();
// Set properties
user.UserName = "Alice";
user.FirstName = "Alice";
user.LastName = "Cooper";
user.FullName = "Alice Cooper";
user.Email = "alice.cooper@domain.com";
user.IsEditor = true;
user.IsGlobalAdministrator = true;
user.PreferredCultureCode = "en-us";
user.Enabled = true;
// Create new user
CMS.SiteProvider.UserInfoProvider.SetUserInfo(user);
// Prepare the TreeProvider (it must be initialized with user information when editing
document structure)
UserInfo ui = UserInfoProvider.GetUserInfo("administrator");
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);
// Get the document (current culture)
CMS.TreeEngine.TreeNode node =
tree.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName,
"/News/TestingWorkflow",
CMS.CMSHelper.CMSContext.CurrentUser.PreferredCultureCode, false, null, false);
if (node != null)
{
// Always delete the document with DocumentHelper, it handles all the
dependencies
CMS.WorkflowEngine.DocumentHelper.DeleteDocument(node, tree, true,
true,true);
}
Example - Creating
new user
Example – Delete
Document
API Everywhere!
• Class View is your Friend
CMS.SettingsProvider
.SettingsHelper
.SQLHelperClass
.TranslationHelp
er
CMS.GlobalHelper
.DataHelper
.ContextHelper
.AJAXHelper
Library Specific
CMS.Controls.CM
SControlsHelper
CMS.WorkflowEn
gine.DocumentHe
lper
CMS.Blogs.BlogHe
lper
Some Examples…
Best practice Tip:
Class view is customizable to allow
personalized organization and viewing
Helpers and general libraries
SettingsProvider
(metadata helpers)
SettingsHelper
(web.config)
SettingsKeyHelper
(web site settings)
SqlHelperClass
(low level DB connection, used
only from SettingsProvider)
DataHelper
(basic data manipulation)
TranslationHelper
(conversion of IDs based on
code names or GUIDs)
GlobalHelper
(general helpers)
/Context
(HTTP context related data)
/Data
(advanced data manipulation and
validation)
/Globalization
(resource strings and cultures)
/Markup
(macros, HTML, XML, text, script)
/Media
(images and media manipulation
and information)
Library specific
(module helpers)
ControlsHelper
CMSControlsHelper
DocumentHelper
WebFarmSyncHelperClass
Etc.
App_Code
(helper functions)
Functions.cs
InstallerFunctions.cs
BlogFunctions.cs
EcommerceFunctions.cs
Etc.
Best Practice Tip
• For general code locate the appropriate helper and use it
• If the helper contains similar methods override and extend
• Implement new behavior in helpers
CMS Context
• CMS.CMSHelper.CMSContext class provides static
methods to access common information
Method
CurrentAliasPath
CurrentDocument
CurrentPageInfo
CurrentSite
CurrentSiteName
CurrentUser
ViewMode
ResolveCurrentPath
Need a code snippet?
Document Management – How documents are stored
• Documents stored in SQL joined tables
– CMS_Tree – Table with basic document data shared between different
language versions. Contains one record for all culture version of the
document
– CMS_Document – Table with document data of specified language
version of the document. Contains one record representing one
language version of the document
– Coupled table – table that contains custom document type fields
CMS_Tree
CMS_Document Coupled table
CMS_Document Coupled table
CMS_Document Coupled table
Best Practice Tip:
Every document is stored in up to three (3) tables. Use the
API to access documents
Document Management – Versioning Internals
• Document versions and its history are stored in separate
tables
– CMS_VersionHistory – Table containing the document versions. Each
version of the document is represented by one record that contains
the complete document data in XML.
– CMS_AttachmentHistory – Table containing the attachment version
records. Each attachment version is bound to one or more document
versions. Every record contains binary data of the attachment.
– CMS_VersionAttachment – Table containing the bindings of the
attachment versions to the document versions.
CMS_VersionHistory
CMS_VersionAttachment
CMS_AttachmentHistory
Version of attachments
CMS_VersionAttachment
CMS_AttachmentHistory
Version of attachments
Document Management Techniques
CMS.TreeEngine.TreeNode
• Not aware of
versioning/workflow/attachments
• Only works with published records
CMS.WorkflowEngine.DocumentHelper
• Versioning/workflow/attachment aware
• Use for all document deletes
Best Practice Tip:
CMS.WorkflowEngine.DocumentHelper is recommended to access
document information
CMS.CMSHelper.TreeHelper allows
access to documents directly
Best Practice Tip:
TreeHelper.GetDocuments checks the view mode and then
calls either TreeProvider or DocumentHelper
Global Events
• Provide a way to execute custom events within the CMS
system
• Managed as a separate projects
• Web Config Key
Best Practice Tip:
Developer documentation contains step by step instructions for
implementing Global Events
Global Event Classes
• The events are applied to all data items that are stored to the database. It
includes documents, user information or any other settings
• Receives DataClass
CustomDataHandler.cs
• Event applied to all exceptions that occur
• Receives System.exception
CustomExceptionHandler.cs
• Allows the integration of external databases and modify the authentication
and authorization processCustomSecurityHandler.cs
• Execute custom actions when a document is created, updated or deletedCustomTreeNodeHandler.cs
• Event applied to workflow documents (same as CustomTreeNodeHandler)
• Same as CustomtreeNodeHandler
CustomWorkflowHandler.cs
Best Practice Tip:
For Document events always use either the CustomTreeNodeHandler (no workflow) or
CustomWorkFlowHandler (workflow) not the CustomDataHandler
Modules
• Extend the CMS system to include your custom code
Additional Information
• Best samples are in your project!
• Get your poster
• Documentation -
http://devnet.kentico.com/Documentation.aspx
• Code Snippet Library -
http://devnet.kentico.com/Blogs/Thomas-Robbins.aspx
• Marketplace -
http://devnet.kentico.com/Marketplace.aspx

More Related Content

What's hot

mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교
Woo Yeong Choi
 

What's hot (20)

Vue, vue router, vuex
Vue, vue router, vuexVue, vue router, vuex
Vue, vue router, vuex
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
 
Intro to exploits in metasploitand payloads in msfvenom
Intro to exploits in metasploitand payloads in msfvenomIntro to exploits in metasploitand payloads in msfvenom
Intro to exploits in metasploitand payloads in msfvenom
 
Kafka Tutorial: Kafka Security
Kafka Tutorial: Kafka SecurityKafka Tutorial: Kafka Security
Kafka Tutorial: Kafka Security
 
NVIDIA Rapids presentation
NVIDIA Rapids presentationNVIDIA Rapids presentation
NVIDIA Rapids presentation
 
Unit 4
Unit 4Unit 4
Unit 4
 
mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용
 
MLOps.pptx
MLOps.pptxMLOps.pptx
MLOps.pptx
 
Vue.js
Vue.jsVue.js
Vue.js
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
BigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQLBigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQL
 
Introduction to MLflow
Introduction to MLflowIntroduction to MLflow
Introduction to MLflow
 
Capture the Streams of Database Changes
Capture the Streams of Database ChangesCapture the Streams of Database Changes
Capture the Streams of Database Changes
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 
Scikit-Learn: Machine Learning in Python
Scikit-Learn: Machine Learning in PythonScikit-Learn: Machine Learning in Python
Scikit-Learn: Machine Learning in Python
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Machine Learning with PyCarent + MLflow
Machine Learning with PyCarent + MLflowMachine Learning with PyCarent + MLflow
Machine Learning with PyCarent + MLflow
 

Similar to Using the Kentico CMS API

SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
Richard Harbridge
 
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Raza Baloch
 
I p-o in different data processing systems
I p-o in different data processing systemsI p-o in different data processing systems
I p-o in different data processing systems
Kinshook Chaturvedi
 
Configuration Management
Configuration ManagementConfiguration Management
Configuration Management
elliando dias
 
Content Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne BailieContent Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne Bailie
Content Strategy Workshops
 

Similar to Using the Kentico CMS API (20)

Patterns For Parallel Computing
Patterns For Parallel ComputingPatterns For Parallel Computing
Patterns For Parallel Computing
 
Ikenstudiolive
IkenstudioliveIkenstudiolive
Ikenstudiolive
 
How To Implement a CMS
How To Implement a CMSHow To Implement a CMS
How To Implement a CMS
 
ASMUG February 2015 Knowledge Event
ASMUG February 2015 Knowledge EventASMUG February 2015 Knowledge Event
ASMUG February 2015 Knowledge Event
 
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
 
FME World Tour 2015 - FME & Data Migration Simon McCabe
FME World Tour 2015 -  FME & Data Migration Simon McCabeFME World Tour 2015 -  FME & Data Migration Simon McCabe
FME World Tour 2015 - FME & Data Migration Simon McCabe
 
DBMS an Example
DBMS an ExampleDBMS an Example
DBMS an Example
 
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
 
Choosing a CMS: One Management System to Rule Them All?
Choosing a CMS: One Management System to Rule Them All?Choosing a CMS: One Management System to Rule Them All?
Choosing a CMS: One Management System to Rule Them All?
 
CMS by Thai Son
CMS by Thai SonCMS by Thai Son
CMS by Thai Son
 
Sad52 requirement
Sad52 requirementSad52 requirement
Sad52 requirement
 
CUST-3 Document Management with Share
CUST-3 Document Management with ShareCUST-3 Document Management with Share
CUST-3 Document Management with Share
 
Ch13
Ch13Ch13
Ch13
 
Content mgmtsys
Content mgmtsysContent mgmtsys
Content mgmtsys
 
Moss Governance Guidelines
Moss Governance GuidelinesMoss Governance Guidelines
Moss Governance Guidelines
 
WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2
 
3-Tier Architecture Step By Step Exercises
3-Tier Architecture Step By Step Exercises3-Tier Architecture Step By Step Exercises
3-Tier Architecture Step By Step Exercises
 
I p-o in different data processing systems
I p-o in different data processing systemsI p-o in different data processing systems
I p-o in different data processing systems
 
Configuration Management
Configuration ManagementConfiguration Management
Configuration Management
 
Content Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne BailieContent Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne Bailie
 

More from Thomas Robbins

One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
Thomas Robbins
 

More from Thomas Robbins (20)

PlayFab Advanced Cloud Script
PlayFab Advanced Cloud ScriptPlayFab Advanced Cloud Script
PlayFab Advanced Cloud Script
 
What’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewardsWhat’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewards
 
Getting started with Cloud Script
Getting started with Cloud ScriptGetting started with Cloud Script
Getting started with Cloud Script
 
Say hello to the new PlayFab!
Say hello to the new PlayFab!Say hello to the new PlayFab!
Say hello to the new PlayFab!
 
Data-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of ValueData-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of Value
 
Financial Transparency Trailblazers
Financial Transparency TrailblazersFinancial Transparency Trailblazers
Financial Transparency Trailblazers
 
Telling Stories with Open Data
Telling Stories with Open DataTelling Stories with Open Data
Telling Stories with Open Data
 
Socrata Financial Transparency Suite
Socrata Financial Transparency Suite Socrata Financial Transparency Suite
Socrata Financial Transparency Suite
 
Socrata Service Connect
Socrata Service ConnectSocrata Service Connect
Socrata Service Connect
 
Leveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive InnovationLeveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive Innovation
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Here Comes Kentico 8
Here Comes Kentico 8Here Comes Kentico 8
Here Comes Kentico 8
 
Say hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrivedSay hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrived
 
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Digital marketing best practices
Digital marketing best practices Digital marketing best practices
Digital marketing best practices
 
Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?
 
Common questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMSCommon questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMS
 
Advanced development with Windows Azure
Advanced development with Windows AzureAdvanced development with Windows Azure
Advanced development with Windows Azure
 
Best Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows AzureBest Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows Azure
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 

Using the Kentico CMS API

  • 1. Using the Kentico CMS API Thom Robbins (thomasr@kentico.com Bryan Soltis (bryan@bitwizards.com)
  • 2. Agenda • Overview (Architecture/Objects) (Thom) • CMS Context (Bryan) • Document Management (Thom) • Global Events (Thom) • Modules (Bryan)
  • 3. Looking at Kentico CMS Logical three tier architecture…
  • 4. Architecture breakdown Data layer (+metadata) Business layer Controls libraries UI components Web project pages Live site pages + admin UI pages Web parts + User controls CMSControls Helpers SettingsProvider Enumerations Infos & Providers Data engine GeneralConnection Abstract info Metadata infos (Class, Query, SettingsKey) Interfaces Third party code Module web parts + Module user controls Module controls Module Infos & Providers Module definitions Presentationlayer Best Practice Tip • Kentico CMS web site project provides examples of all sorts of code!
  • 5. OO Basics - Object Creation Examples // Create UserInfo CMS.SiteProvider.UserInfo user = new CMS.SiteProvider.UserInfo(); // Set properties user.UserName = "Alice"; user.FirstName = "Alice"; user.LastName = "Cooper"; user.FullName = "Alice Cooper"; user.Email = "alice.cooper@domain.com"; user.IsEditor = true; user.IsGlobalAdministrator = true; user.PreferredCultureCode = "en-us"; user.Enabled = true; // Create new user CMS.SiteProvider.UserInfoProvider.SetUserInfo(user); // Prepare the TreeProvider (it must be initialized with user information when editing document structure) UserInfo ui = UserInfoProvider.GetUserInfo("administrator"); CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui); // Get the document (current culture) CMS.TreeEngine.TreeNode node = tree.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/News/TestingWorkflow", CMS.CMSHelper.CMSContext.CurrentUser.PreferredCultureCode, false, null, false); if (node != null) { // Always delete the document with DocumentHelper, it handles all the dependencies CMS.WorkflowEngine.DocumentHelper.DeleteDocument(node, tree, true, true,true); } Example - Creating new user Example – Delete Document
  • 6. API Everywhere! • Class View is your Friend CMS.SettingsProvider .SettingsHelper .SQLHelperClass .TranslationHelp er CMS.GlobalHelper .DataHelper .ContextHelper .AJAXHelper Library Specific CMS.Controls.CM SControlsHelper CMS.WorkflowEn gine.DocumentHe lper CMS.Blogs.BlogHe lper Some Examples… Best practice Tip: Class view is customizable to allow personalized organization and viewing
  • 7. Helpers and general libraries SettingsProvider (metadata helpers) SettingsHelper (web.config) SettingsKeyHelper (web site settings) SqlHelperClass (low level DB connection, used only from SettingsProvider) DataHelper (basic data manipulation) TranslationHelper (conversion of IDs based on code names or GUIDs) GlobalHelper (general helpers) /Context (HTTP context related data) /Data (advanced data manipulation and validation) /Globalization (resource strings and cultures) /Markup (macros, HTML, XML, text, script) /Media (images and media manipulation and information) Library specific (module helpers) ControlsHelper CMSControlsHelper DocumentHelper WebFarmSyncHelperClass Etc. App_Code (helper functions) Functions.cs InstallerFunctions.cs BlogFunctions.cs EcommerceFunctions.cs Etc. Best Practice Tip • For general code locate the appropriate helper and use it • If the helper contains similar methods override and extend • Implement new behavior in helpers
  • 8. CMS Context • CMS.CMSHelper.CMSContext class provides static methods to access common information Method CurrentAliasPath CurrentDocument CurrentPageInfo CurrentSite CurrentSiteName CurrentUser ViewMode ResolveCurrentPath Need a code snippet?
  • 9. Document Management – How documents are stored • Documents stored in SQL joined tables – CMS_Tree – Table with basic document data shared between different language versions. Contains one record for all culture version of the document – CMS_Document – Table with document data of specified language version of the document. Contains one record representing one language version of the document – Coupled table – table that contains custom document type fields CMS_Tree CMS_Document Coupled table CMS_Document Coupled table CMS_Document Coupled table Best Practice Tip: Every document is stored in up to three (3) tables. Use the API to access documents
  • 10. Document Management – Versioning Internals • Document versions and its history are stored in separate tables – CMS_VersionHistory – Table containing the document versions. Each version of the document is represented by one record that contains the complete document data in XML. – CMS_AttachmentHistory – Table containing the attachment version records. Each attachment version is bound to one or more document versions. Every record contains binary data of the attachment. – CMS_VersionAttachment – Table containing the bindings of the attachment versions to the document versions. CMS_VersionHistory CMS_VersionAttachment CMS_AttachmentHistory Version of attachments CMS_VersionAttachment CMS_AttachmentHistory Version of attachments
  • 11. Document Management Techniques CMS.TreeEngine.TreeNode • Not aware of versioning/workflow/attachments • Only works with published records CMS.WorkflowEngine.DocumentHelper • Versioning/workflow/attachment aware • Use for all document deletes Best Practice Tip: CMS.WorkflowEngine.DocumentHelper is recommended to access document information CMS.CMSHelper.TreeHelper allows access to documents directly Best Practice Tip: TreeHelper.GetDocuments checks the view mode and then calls either TreeProvider or DocumentHelper
  • 12. Global Events • Provide a way to execute custom events within the CMS system • Managed as a separate projects • Web Config Key Best Practice Tip: Developer documentation contains step by step instructions for implementing Global Events
  • 13. Global Event Classes • The events are applied to all data items that are stored to the database. It includes documents, user information or any other settings • Receives DataClass CustomDataHandler.cs • Event applied to all exceptions that occur • Receives System.exception CustomExceptionHandler.cs • Allows the integration of external databases and modify the authentication and authorization processCustomSecurityHandler.cs • Execute custom actions when a document is created, updated or deletedCustomTreeNodeHandler.cs • Event applied to workflow documents (same as CustomTreeNodeHandler) • Same as CustomtreeNodeHandler CustomWorkflowHandler.cs Best Practice Tip: For Document events always use either the CustomTreeNodeHandler (no workflow) or CustomWorkFlowHandler (workflow) not the CustomDataHandler
  • 14. Modules • Extend the CMS system to include your custom code
  • 15. Additional Information • Best samples are in your project! • Get your poster • Documentation - http://devnet.kentico.com/Documentation.aspx • Code Snippet Library - http://devnet.kentico.com/Blogs/Thomas-Robbins.aspx • Marketplace - http://devnet.kentico.com/Marketplace.aspx

Editor's Notes

  1. Standard 3-tier architecture Data driven object model (bussiness layer objects content based on metadata) UI consists of server controls, user controls and pages Modules are logically separated
  2. We have helpers for almost everything If you plan to write any general code that can be used later by someone else: Locate the helper If the helper contains the method, use it If the helper contains similar method, enhance it by overriding it and provide original method so that the behavior of existing calls stays the same If the helper doesn’t contain the method, implement it in the helper