SlideShare a Scribd company logo
What is Sitecore MVC? 
Out on the razor’s edge 
Prepared by: Jason St-Cyr and Nick Allen
What is Sitecore MVC? 
• MVC as you may know it 
• Sitecore MVC 
• Why bother moving to Sitecore MVC? 
Resources
MVC as you may know it 
• ASP.NET MVC 
- Model, View, Controller pattern 
- Interactions are routed through controllers, no post-backs 
- Views mapped to REST-friendly URLs 
- Light-weight, highly testable framework 
- No View State or server-based forms 
- Razor as the view engine 
- Convention over configuration 
Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 4
MVC as you know it: Route registration 
public class MvcApplication : System.Web.HttpApplication 
{ 
public static void RegisterRoutes(RouteCollection routes) 
{ 
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
routes.MapRoute( 
"Default", // Route name 
"{controller}/{action}/{id}", // URL with parameters 
new { controller = "Home", action = "Index", id = "" } // Parameter defaults 
); 
} 
protected void Application_Start() 
{ 
RegisterRoutes(RouteTable.Routes); 
} 
}
MVC as you know it: Controllers 
public class CustomerController : Controller 
{ 
// 
// POST: /Customer/Edit/5 
[AcceptVerbs(HttpVerbs.Post)] 
public ActionResult Edit(int id, FormCollection collection) 
{ 
try 
{ 
// TODO: Add update logic here 
return RedirectToAction("Index"); 
} 
catch 
{ 
return View(); 
} 
} 
}
Sitecore MVC 
• Sitecore MVC != ASP.NET MVC 
- Can use MVC routing, but defaults to using Sitecore as routing engine 
- Sitecore constructs page based on placeholder settings and 
presentation details, just like with Web Forms 
- Individual components are defined as Controller Renderings or View 
Renderings 
- Instead of ‘controller-per-page’, Sitecore uses ‘controller-per-rendering’ 
- Sitecore will run in “MVC mode” if: 
a) An MVC route is matched 
b) Item layout is an MVC view 
Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 7
Sitecore MVC: Controller vs. View Renderings 
• Controller Rendering 
• Executes Controller you 
build 
• Can specify relative or fully 
qualified class for 
controller 
• Controller logic builds 
model and determines 
views 
• Controller is similar to 
code-behind of an ASCX 
• View Rendering 
• Sitecore becomes the 
Controller 
• Directly binds to an 
associated .cshtml file 
• Requires a model item, 
which binds directly to 
rendering model class 
• Useful for ‘presentation-only’ 
renderings (e.g. layout 
renderings) 
Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 8
Why bother? 
• Sitecore is going MVC 
- Sitecore 8: all UIs in SPEAK 
• Developers want to work with MVC solutions 
- Separation of concerns (presentation vs code-behind) 
- Makes unit testing easier (if you do it right) 
- Re-use logic and models more easily between views 
- More control over rendered HTML (no view state garbage) 
• Clients are beginning to ask for MVC solutions 
- Doing both > Only web forms 
• Web Forms will go away (many years from now, but still…) 
Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 9
Resources
Sitecore Community Docs 
• http://sitecore-community. 
github.io/docs/documentation/Sitecore%20MV 
C/index.html 
• Contains links to online content submitted by the Sitecore 
community. 
• Key links: 
- Anything by Martina Welander 
- Creating a Visual Studio Project for Sitecore MVC 
- Sample Sitecore MVC project (used in Youtube tutorial videos) 
Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 11
MSDN and others 
• ASP.NET MVC Overview: 
- http://msdn.microsoft.com/en-us/ 
library/dd381412(v=vs.100).aspx 
• Getting Started with ASP.NET MVC 5 
- http://www.asp.net/mvc/overview/getting-started/ 
introduction/getting-started 
• PluralSight ASP.NET MVC 5 Fundamentals 
- http://www.pluralsight.com/courses/aspdotnet-mvc5- 
fundamentals
Jason St-Cyr 
 Solution Architect and Sitecore MVP, nonlinear digital 
Lessons Learned 
 Background in .NET software development and Application Lifecycle 
Management 
 Contact me: jst-cyr@nonlinear.ca 
 Around the web: 
 Technical Blog: 
http://theagilecoder.wordpress.com 
 LinkedIn Profile: 
http://www.linkedin.com/pub/jason-st-cyr/26/a73/645 
 Nonlinear Thinking: 
http://www.nonlinearcreations.com/Digital/how-we-think 
 Twitter: @AgileStCyr
Nick Allen 
 Solution Architect and Sitecore MVP, nonlinear digital 
Lessons Learned 
 Background in .NET software development 
 Contact me: nallen@nonlinear.ca 
 Around the web: 
 Technical Blog: 
http://sitecorecreative.wordpress.com 
 LinkedIn Profile: 
https://www.linkedin.com/in/nickallen80 
 Nonlinear Thinking: 
http://www.nonlinearcreations.com/Digital/how-we-think 
 Twitter: @sitecoretweet

More Related Content

What's hot

SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4
Jon Galloway
 
Fun with Social, Windows 8 and Javascript
Fun with Social, Windows 8 and JavascriptFun with Social, Windows 8 and Javascript
Fun with Social, Windows 8 and Javascript
Joris Poelmans
 

What's hot (20)

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
 
SharePoint 2010 Web Content Management - The Developer Story
SharePoint 2010 Web Content Management - The Developer StorySharePoint 2010 Web Content Management - The Developer Story
SharePoint 2010 Web Content Management - The Developer Story
 
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
 
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin TimmermannO365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
6 The UI Structure and The Web API
6 The UI Structure and The Web API6 The UI Structure and The Web API
6 The UI Structure and The Web API
 
Using the Kentico CMS API
Using the Kentico CMS APIUsing the Kentico CMS API
Using the Kentico CMS API
 
SharePoint Framework - Developer Preview
SharePoint Framework - Developer PreviewSharePoint Framework - Developer Preview
SharePoint Framework - Developer Preview
 
Salesforce Lightning workshop Hartford - 12 March
Salesforce Lightning workshop Hartford - 12 MarchSalesforce Lightning workshop Hartford - 12 March
Salesforce Lightning workshop Hartford - 12 March
 
Introducing Office Web Apps as a Tool for Developing Content Rich Applications
Introducing Office Web Apps as a Tool for Developing Content Rich ApplicationsIntroducing Office Web Apps as a Tool for Developing Content Rich Applications
Introducing Office Web Apps as a Tool for Developing Content Rich Applications
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
 
Developing Sandbox Solutions
Developing Sandbox SolutionsDeveloping Sandbox Solutions
Developing Sandbox Solutions
 
SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4
 
Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017
 
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenO365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
MOKA .Net Study Week 02
MOKA .Net Study Week 02MOKA .Net Study Week 02
MOKA .Net Study Week 02
 
Sitecore and Responsive Web Design
Sitecore and Responsive Web Design Sitecore and Responsive Web Design
Sitecore and Responsive Web Design
 
Fun with Social, Windows 8 and Javascript
Fun with Social, Windows 8 and JavascriptFun with Social, Windows 8 and Javascript
Fun with Social, Windows 8 and Javascript
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 

Similar to Sitecore MVC: What it is and why it's important

Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
Mayank Srivastava
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
MaslowB
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 

Similar to Sitecore MVC: What it is and why it's important (20)

Fast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVCFast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVC
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
4. Introduction to ASP.NET MVC - Part I
4. Introduction to ASP.NET MVC - Part I4. Introduction to ASP.NET MVC - Part I
4. Introduction to ASP.NET MVC - Part I
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
ASP.NET MVC4 Overview
ASP.NET MVC4 OverviewASP.NET MVC4 Overview
ASP.NET MVC4 Overview
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
 
Session 46 - Spring - Part 4 - Spring MVC
Session 46 - Spring - Part 4 - Spring MVCSession 46 - Spring - Part 4 - Spring MVC
Session 46 - Spring - Part 4 - Spring MVC
 
SpringPeople Building Web Sites with ASP.NET MVC FRAMEWORK
SpringPeople Building Web Sites with ASP.NET MVC FRAMEWORKSpringPeople Building Web Sites with ASP.NET MVC FRAMEWORK
SpringPeople Building Web Sites with ASP.NET MVC FRAMEWORK
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
 
ASP.NET MVC overview
ASP.NET MVC overviewASP.NET MVC overview
ASP.NET MVC overview
 

More from nonlinear creations

Sitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testingSitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testing
nonlinear creations
 

More from nonlinear creations (17)

Sitecore User Group: Session State and Sitecore xDB
Sitecore User Group: Session State and Sitecore xDB Sitecore User Group: Session State and Sitecore xDB
Sitecore User Group: Session State and Sitecore xDB
 
Sitecore on Azure
Sitecore on AzureSitecore on Azure
Sitecore on Azure
 
Unofficial Sitecore Training - Data enrichment and personalization
Unofficial Sitecore Training - Data enrichment and personalizationUnofficial Sitecore Training - Data enrichment and personalization
Unofficial Sitecore Training - Data enrichment and personalization
 
The SickKids Foundation on enabling a digital CXM 'hub' with Sitecore
The SickKids Foundation on enabling a digital CXM 'hub' with SitecoreThe SickKids Foundation on enabling a digital CXM 'hub' with Sitecore
The SickKids Foundation on enabling a digital CXM 'hub' with Sitecore
 
Intranet trends to watch
Intranet trends to watchIntranet trends to watch
Intranet trends to watch
 
Design Credibility: No one trusts an ugly website
Design Credibility: No one trusts an ugly websiteDesign Credibility: No one trusts an ugly website
Design Credibility: No one trusts an ugly website
 
National Wildlife Federation- OMS- Dreamcore 2011
National Wildlife Federation- OMS- Dreamcore 2011National Wildlife Federation- OMS- Dreamcore 2011
National Wildlife Federation- OMS- Dreamcore 2011
 
Spiral into control with Knowledge Management
Spiral into control with Knowledge ManagementSpiral into control with Knowledge Management
Spiral into control with Knowledge Management
 
Icebergs
IcebergsIcebergs
Icebergs
 
8 tips for successful change management
8 tips for successful change management8 tips for successful change management
8 tips for successful change management
 
Cms project-failing-the-software-or-the-partner
Cms project-failing-the-software-or-the-partnerCms project-failing-the-software-or-the-partner
Cms project-failing-the-software-or-the-partner
 
Understanding cloud platform services
Understanding cloud platform servicesUnderstanding cloud platform services
Understanding cloud platform services
 
ALM 101: An introduction to application lifecycle management
ALM 101: An introduction to application lifecycle managementALM 101: An introduction to application lifecycle management
ALM 101: An introduction to application lifecycle management
 
Understanding web engagement management (WEM) and your social media presence
Understanding web engagement management (WEM) and your social media presenceUnderstanding web engagement management (WEM) and your social media presence
Understanding web engagement management (WEM) and your social media presence
 
Sitecore: Understanding your visitors and user personas
Sitecore: Understanding your visitors and user personas Sitecore: Understanding your visitors and user personas
Sitecore: Understanding your visitors and user personas
 
Social intranets: 10 ways to drive adoption
Social intranets: 10 ways to drive adoptionSocial intranets: 10 ways to drive adoption
Social intranets: 10 ways to drive adoption
 
Sitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testingSitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testing
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 

Sitecore MVC: What it is and why it's important

  • 1. What is Sitecore MVC? Out on the razor’s edge Prepared by: Jason St-Cyr and Nick Allen
  • 2. What is Sitecore MVC? • MVC as you may know it • Sitecore MVC • Why bother moving to Sitecore MVC? Resources
  • 3.
  • 4. MVC as you may know it • ASP.NET MVC - Model, View, Controller pattern - Interactions are routed through controllers, no post-backs - Views mapped to REST-friendly URLs - Light-weight, highly testable framework - No View State or server-based forms - Razor as the view engine - Convention over configuration Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 4
  • 5. MVC as you know it: Route registration public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); } }
  • 6. MVC as you know it: Controllers public class CustomerController : Controller { // // POST: /Customer/Edit/5 [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here return RedirectToAction("Index"); } catch { return View(); } } }
  • 7. Sitecore MVC • Sitecore MVC != ASP.NET MVC - Can use MVC routing, but defaults to using Sitecore as routing engine - Sitecore constructs page based on placeholder settings and presentation details, just like with Web Forms - Individual components are defined as Controller Renderings or View Renderings - Instead of ‘controller-per-page’, Sitecore uses ‘controller-per-rendering’ - Sitecore will run in “MVC mode” if: a) An MVC route is matched b) Item layout is an MVC view Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 7
  • 8. Sitecore MVC: Controller vs. View Renderings • Controller Rendering • Executes Controller you build • Can specify relative or fully qualified class for controller • Controller logic builds model and determines views • Controller is similar to code-behind of an ASCX • View Rendering • Sitecore becomes the Controller • Directly binds to an associated .cshtml file • Requires a model item, which binds directly to rendering model class • Useful for ‘presentation-only’ renderings (e.g. layout renderings) Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 8
  • 9. Why bother? • Sitecore is going MVC - Sitecore 8: all UIs in SPEAK • Developers want to work with MVC solutions - Separation of concerns (presentation vs code-behind) - Makes unit testing easier (if you do it right) - Re-use logic and models more easily between views - More control over rendered HTML (no view state garbage) • Clients are beginning to ask for MVC solutions - Doing both > Only web forms • Web Forms will go away (many years from now, but still…) Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 9
  • 11. Sitecore Community Docs • http://sitecore-community. github.io/docs/documentation/Sitecore%20MV C/index.html • Contains links to online content submitted by the Sitecore community. • Key links: - Anything by Martina Welander - Creating a Visual Studio Project for Sitecore MVC - Sample Sitecore MVC project (used in Youtube tutorial videos) Toronto | Ottawa | New York | Calgary | São Paulo | Florianópolis 11
  • 12. MSDN and others • ASP.NET MVC Overview: - http://msdn.microsoft.com/en-us/ library/dd381412(v=vs.100).aspx • Getting Started with ASP.NET MVC 5 - http://www.asp.net/mvc/overview/getting-started/ introduction/getting-started • PluralSight ASP.NET MVC 5 Fundamentals - http://www.pluralsight.com/courses/aspdotnet-mvc5- fundamentals
  • 13. Jason St-Cyr  Solution Architect and Sitecore MVP, nonlinear digital Lessons Learned  Background in .NET software development and Application Lifecycle Management  Contact me: jst-cyr@nonlinear.ca  Around the web:  Technical Blog: http://theagilecoder.wordpress.com  LinkedIn Profile: http://www.linkedin.com/pub/jason-st-cyr/26/a73/645  Nonlinear Thinking: http://www.nonlinearcreations.com/Digital/how-we-think  Twitter: @AgileStCyr
  • 14. Nick Allen  Solution Architect and Sitecore MVP, nonlinear digital Lessons Learned  Background in .NET software development  Contact me: nallen@nonlinear.ca  Around the web:  Technical Blog: http://sitecorecreative.wordpress.com  LinkedIn Profile: https://www.linkedin.com/in/nickallen80  Nonlinear Thinking: http://www.nonlinearcreations.com/Digital/how-we-think  Twitter: @sitecoretweet