SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Sitecore MVC
What we will see today? Areyouexcited?
• What is Sitecore MVC
• How does it differ from regular .NET MVC?
• Using Web forms and MVC within one solution Sitecore
• Should we use Sitecore MVC?
• Installing and Configuring Sitecore MVC
• Renderings
• @Html.Sitecore() Helper and creating custom Sitecore helper
• Using your own model instead of RenderingModel
What is Sitecore MVC?
• A View, It is the component that displays the application's user interface (UI) (all of the things
the user can see and respond to on the screen, such as buttons, display boxes, and so forth).
• A Model, which represents the underlying, logical structure of data in a software application
and the high-level class associated with it at data domain. This object model does not contain
any information about the user interface and the implementation.
• A Controller, which represents the underlying, logical structure of data in a software application
and the high-level class associated with it. This object model does not contain any information
about the user interface.
A traditional ASP.NET MVC request
Using Web forms and MVC within one
solution Sitecore
• Yes. We can use both the approach, a traditional web form and even a MVC in a single solution
of Sitecore project.
• I know you guys will have question,
How it will differentiate a traditional Web form request and MVC request in Sitecore?
Sitecore MVC request
Should we use Sitecore MVC?
• Yes
• No
• Both are true answers.
We should ask question instead,
When we should use Sitecore MVC?
MVC Web Forms
• Shorter page lifecycle, better performance • Extra built-in security
• Steep learning curve for web forms developers and junior developers • Faster to build, less classes
• Easy to add DI and more flexible unit testing • Easier to understand for less seasoned .NET developers
* Forces a convention and cleaner coding • Larger knowledge base/ documentation and more tutorials available
• RAZOR view engine is very convenient for front-end integration. • More developers out there with experience in coding with web forms & Sitecore
• Will be supported by Sitecore going forward (we have confirmed this from the
very top)
• Will be supported by Sitecore going forward
• Helps pull new talent, newer framework (with Sitecore) • Will not be made redundant by MVC any time soon
• We would advice that you have a fairly senior .NET development team (That we
have, without any doubt).
• More Sitecore partners are familiar with web forms, so more support available if
short-staffed or something goes wrong
• There are some very large Sitecore clients implementing solutions with MVC,
some of which are already live.
• Tried and tested, most existing Sitecore solutions are built with web forms.
• Very stable, MVC has been around with .NET for a long time, there was not a lot
of core code Sitecore needed to change to support MVC
• Very stable
• Good de-coupling from HTML, no need to worry about automatic ID's generated
by web-forms controls, resulting in cleaner HTML output.
• Fastest approach to get a clean application live for a company with predominantly
web forms experience.
Renderings
Common Renderings
• Method Rendering
• Url Rendering
• Item rendering
• Webcontrol
• Xsl Rendering
MVC specific renderings
• View renderings
• Controller renderings
View Rendering
A view rendering consists of a view that takes a RenderingModel by default. The model is
assembled by the Sitecore MVC pipeline, and you can create your own, custom models. Because
the pipeline expects an Initialize() method on your model, you can either inherit from
RenderingModel or implement IRenderingModel.
To post a view rendering, specify the controller and action that you want to post to on the
component’s definition item.
Advantages
• They are simple to use – especially if you do not use a custom model. Most of the time, you only
want to display some content from the context or data source item without requiring any
business logic – a simple ‘page’ will often consist of a title and some text, which you can do very
easily with Sitecore’s RenderingModel and the @Html.Sitecore() helper. There isn’t much to unit
test here (you can certainly do web tests), and creating a controller action seems extraneous.
• When you post a form from a view rendering, it will only post the action you have specified – after which you
can redirect to another page or trigger the Sitecore rendering pipeline. This is not the case with controller
renderings, which make posting forms a bit more difficult.
Disadvantages
• If you need to do any business logic when retrieving your model, you will want to do that in a separate layer.
However, because you do not have access to a controller, the only place you can do this logic is in the
Initialize() method of a custom model – and putting business logic in the model itself is not ideal.
• It’s just not very ASP.NET MVC. Developers are used to having a controller and an action, and view renderings
do not work like that. However, you must keep in mind that Sitecore MVC is an implementation of ASP.NET
MVC that needs to support the same features as its Web Forms counterpart. The modular nature of a Sitecore
page introduces challenges.
Controller Rendering
Rather than specifying a view, the component definition item for a controller rendering specifies
a controller name and an action name. When the rendering is added to a placeholder, this
action is executed and the view is returned.
Advantages
• They look ASP.NET MVC. You can use dependency injection and common patterns (like the
repository pattern) as you normally would, and create your own actions.
• Keeps your business logic separate from your model; you can create plain POCO classes that are
hydrated by a business logic layer.
Disadvantages
• Although they look ASP.NET MVC, they are still renderings and will not behave exactly as a controller
action might in a standard ASP.NET MVC application. This is particularly evident when you try to have
more than one post on the page, or attempt to RedirectToAction.
• They are executed after the main view has already been rendered, which results in some
unexpected behavior – again, this might cause some strange behavior when you try to post a form,
and with TempData (if you use that).
• In some instances, a controller rendering is a lot of unnecessary work
@Html.Sitecore() Helper
References
• http://www.hhogdev.com/blog/2012/august/sitecore-mvc-prototype-part1.aspx part - 1
• http://www.hhogdev.com/blog/2012/august/~/link.aspx?_id=F97F95290694409A99655C2F3D90021D&
_z=z part – 2
• http://www.hhogdev.com/blog/2012/august/~/~/link.aspx?_id=B8303C775D554C2A82A337FD4AD48B
E1&_z=z part – 3
• http://mhwelander.net/2014/05/28/posting-forms-in-sitecore-mvc-part-1-view-renderings/
• http://mhwelander.net/2014/05/30/posting-forms-in-sitecore-mvc-part-2-controller-renderings/
• http://mhwelander.net/2014/06/13/view-renderings-vs-controller-renderings/
• Video Tutorials:
• https://www.youtube.com/watch?v=i3Mwcphtz4w part - 1
• https://www.youtube.com/watch?v=dW_rQp9bMmE part – 2
Thank You
CREATED BY PRATIK SATIKUNVAR

Weitere ähnliche Inhalte

Was ist angesagt?

アプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClip
アプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClipアプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClip
アプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomCliptakaaya
 
大規模システムリプレイスへの道
大規模システムリプレイスへの道大規模システムリプレイスへの道
大規模システムリプレイスへの道Recruit Lifestyle Co., Ltd.
 
エンタープライズアジャイルを阻む組織やプロセスと、その処方
エンタープライズアジャイルを阻む組織やプロセスと、その処方エンタープライズアジャイルを阻む組織やプロセスと、その処方
エンタープライズアジャイルを阻む組織やプロセスと、その処方Graat(グラーツ)
 
Firebase Authを Nuxt + Railsの自前サービス に導入してみた
Firebase Authを Nuxt + Railsの自前サービス に導入してみたFirebase Authを Nuxt + Railsの自前サービス に導入してみた
Firebase Authを Nuxt + Railsの自前サービス に導入してみたTomoe Sawai
 
【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~
【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~
【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~Developers Summit
 
CREATIVE SURVEY for Salesforce 概要資料
CREATIVE SURVEY for Salesforce 概要資料CREATIVE SURVEY for Salesforce 概要資料
CREATIVE SURVEY for Salesforce 概要資料Kikuchi Takayuki
 
始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~
始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~
始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~貴志 上坂
 
自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)
自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)
自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)syou6162
 
ブラウザ自動化ツール カオスマップ風 - STAC2018 LT
ブラウザ自動化ツール カオスマップ風 - STAC2018 LTブラウザ自動化ツール カオスマップ風 - STAC2018 LT
ブラウザ自動化ツール カオスマップ風 - STAC2018 LThnisiji
 
AWS CDKに魅入られた PHPer がオススメする
AWS CDKに魅入られた PHPer がオススメするAWS CDKに魅入られた PHPer がオススメする
AWS CDKに魅入られた PHPer がオススメするTaichi Inaba
 
ゼロトラスト・アーキテクチャを無料で(やれるだけ)実現する
ゼロトラスト・アーキテクチャを無料で(やれるだけ)実現するゼロトラスト・アーキテクチャを無料で(やれるだけ)実現する
ゼロトラスト・アーキテクチャを無料で(やれるだけ)実現するKeioOyama
 
はじめてのConfluence!一歩を踏み出そう!
はじめてのConfluence!一歩を踏み出そう!はじめてのConfluence!一歩を踏み出そう!
はじめてのConfluence!一歩を踏み出そう!Narichika Kajihara
 
SageMakerでもAUTOMATIC1111したい
SageMakerでもAUTOMATIC1111したいSageMakerでもAUTOMATIC1111したい
SageMakerでもAUTOMATIC1111したい真吾 吉田
 
LeSSでつなぐビジネスとIT
LeSSでつなぐビジネスとITLeSSでつなぐビジネスとIT
LeSSでつなぐビジネスとITTakao Kimura
 
オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022
オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022
オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022GREE VR Studio Lab
 
Sonar qubeでちょっと楽しい静的解析
Sonar qubeでちょっと楽しい静的解析Sonar qubeでちょっと楽しい静的解析
Sonar qubeでちょっと楽しい静的解析政雄 金森
 
そこそこ速くて安全なRDBの使い方
そこそこ速くて安全なRDBの使い方そこそこ速くて安全なRDBの使い方
そこそこ速くて安全なRDBの使い方ShunsukeNakamura17
 
SharePoint 2013 ワークフロー開発入門
SharePoint 2013 ワークフロー開発入門SharePoint 2013 ワークフロー開発入門
SharePoint 2013 ワークフロー開発入門Hiroaki Oikawa
 

Was ist angesagt? (20)

アプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClip
アプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClipアプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClip
アプリを生み出す現場でUI/UXデザイナーが意識するべきこと:RoomClip
 
大規模システムリプレイスへの道
大規模システムリプレイスへの道大規模システムリプレイスへの道
大規模システムリプレイスへの道
 
エンタープライズアジャイルを阻む組織やプロセスと、その処方
エンタープライズアジャイルを阻む組織やプロセスと、その処方エンタープライズアジャイルを阻む組織やプロセスと、その処方
エンタープライズアジャイルを阻む組織やプロセスと、その処方
 
Firebase Authを Nuxt + Railsの自前サービス に導入してみた
Firebase Authを Nuxt + Railsの自前サービス に導入してみたFirebase Authを Nuxt + Railsの自前サービス に導入してみた
Firebase Authを Nuxt + Railsの自前サービス に導入してみた
 
【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~
【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~
【15-B-7】無意味なアラートからの脱却 ~ Datadogを使ってモダンなモニタリングを始めよう ~
 
CREATIVE SURVEY for Salesforce 概要資料
CREATIVE SURVEY for Salesforce 概要資料CREATIVE SURVEY for Salesforce 概要資料
CREATIVE SURVEY for Salesforce 概要資料
 
始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~
始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~
始めよう! ドメイン駆動設計&マイクロサービス開発 ~C# と Azure Service Fabric で最高の DDD 開発を~
 
自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)
自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)
自分の目的に合った統計量と そのバラ付きを計算しよう ~NPSを例に~(統計学勉強会)
 
Dockerを社内で使うために
Dockerを社内で使うためにDockerを社内で使うために
Dockerを社内で使うために
 
ブラウザ自動化ツール カオスマップ風 - STAC2018 LT
ブラウザ自動化ツール カオスマップ風 - STAC2018 LTブラウザ自動化ツール カオスマップ風 - STAC2018 LT
ブラウザ自動化ツール カオスマップ風 - STAC2018 LT
 
AWS CDKに魅入られた PHPer がオススメする
AWS CDKに魅入られた PHPer がオススメするAWS CDKに魅入られた PHPer がオススメする
AWS CDKに魅入られた PHPer がオススメする
 
ゼロトラスト・アーキテクチャを無料で(やれるだけ)実現する
ゼロトラスト・アーキテクチャを無料で(やれるだけ)実現するゼロトラスト・アーキテクチャを無料で(やれるだけ)実現する
ゼロトラスト・アーキテクチャを無料で(やれるだけ)実現する
 
はじめてのConfluence!一歩を踏み出そう!
はじめてのConfluence!一歩を踏み出そう!はじめてのConfluence!一歩を踏み出そう!
はじめてのConfluence!一歩を踏み出そう!
 
SageMakerでもAUTOMATIC1111したい
SageMakerでもAUTOMATIC1111したいSageMakerでもAUTOMATIC1111したい
SageMakerでもAUTOMATIC1111したい
 
LeSSでつなぐビジネスとIT
LeSSでつなぐビジネスとITLeSSでつなぐビジネスとIT
LeSSでつなぐビジネスとIT
 
オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022
オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022
オープンソースで構築するWebメタバース ~Mozilla Hubsで学ぶUX開発から運用コスト最小化まで #CEDEC2022
 
Sonar qubeでちょっと楽しい静的解析
Sonar qubeでちょっと楽しい静的解析Sonar qubeでちょっと楽しい静的解析
Sonar qubeでちょっと楽しい静的解析
 
SharePoint で始める情報共有とそのアプローチ
SharePoint で始める情報共有とそのアプローチSharePoint で始める情報共有とそのアプローチ
SharePoint で始める情報共有とそのアプローチ
 
そこそこ速くて安全なRDBの使い方
そこそこ速くて安全なRDBの使い方そこそこ速くて安全なRDBの使い方
そこそこ速くて安全なRDBの使い方
 
SharePoint 2013 ワークフロー開発入門
SharePoint 2013 ワークフロー開発入門SharePoint 2013 ワークフロー開発入門
SharePoint 2013 ワークフロー開発入門
 

Andere mochten auch

24 Sitecore Tips that Every Sitecore Architect Needs to Know
24 Sitecore Tips that Every Sitecore Architect Needs to Know24 Sitecore Tips that Every Sitecore Architect Needs to Know
24 Sitecore Tips that Every Sitecore Architect Needs to KnowAshish Bansal
 
Understanding the Sitecore Architecture
Understanding the Sitecore ArchitectureUnderstanding the Sitecore Architecture
Understanding the Sitecore ArchitecturePieter Brinkman
 
Sitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and ConfigurationSitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and ConfigurationCodersCenter
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantnonlinear creations
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsnonlinear creations
 
How to Easily Create a Page in Sitecore
How to Easily Create a Page in SitecoreHow to Easily Create a Page in Sitecore
How to Easily Create a Page in SitecoredotCMS
 
The Sitecore Marketing Technology Ecosystem
The Sitecore Marketing Technology EcosystemThe Sitecore Marketing Technology Ecosystem
The Sitecore Marketing Technology Ecosystemedynamic
 
Know every customer, own every experience, david sigerson, senior business op...
Know every customer, own every experience, david sigerson, senior business op...Know every customer, own every experience, david sigerson, senior business op...
Know every customer, own every experience, david sigerson, senior business op...e3
 
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 nonlinear creations
 
Sitecore xPlatform - Introduction
Sitecore xPlatform - IntroductionSitecore xPlatform - Introduction
Sitecore xPlatform - IntroductionThomas Eldblom
 
Introducing Sitecore - The Experience Platform
Introducing Sitecore - The Experience PlatformIntroducing Sitecore - The Experience Platform
Introducing Sitecore - The Experience PlatformAdrian IORGU
 

Andere mochten auch (11)

24 Sitecore Tips that Every Sitecore Architect Needs to Know
24 Sitecore Tips that Every Sitecore Architect Needs to Know24 Sitecore Tips that Every Sitecore Architect Needs to Know
24 Sitecore Tips that Every Sitecore Architect Needs to Know
 
Understanding the Sitecore Architecture
Understanding the Sitecore ArchitectureUnderstanding the Sitecore Architecture
Understanding the Sitecore Architecture
 
Sitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and ConfigurationSitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and Configuration
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's important
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayouts
 
How to Easily Create a Page in Sitecore
How to Easily Create a Page in SitecoreHow to Easily Create a Page in Sitecore
How to Easily Create a Page in Sitecore
 
The Sitecore Marketing Technology Ecosystem
The Sitecore Marketing Technology EcosystemThe Sitecore Marketing Technology Ecosystem
The Sitecore Marketing Technology Ecosystem
 
Know every customer, own every experience, david sigerson, senior business op...
Know every customer, own every experience, david sigerson, senior business op...Know every customer, own every experience, david sigerson, senior business op...
Know every customer, own every experience, david sigerson, senior business op...
 
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
 
Sitecore xPlatform - Introduction
Sitecore xPlatform - IntroductionSitecore xPlatform - Introduction
Sitecore xPlatform - Introduction
 
Introducing Sitecore - The Experience Platform
Introducing Sitecore - The Experience PlatformIntroducing Sitecore - The Experience Platform
Introducing Sitecore - The Experience Platform
 

Ähnlich wie Sitecore mvc

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 2013Thomas Robbins
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentationMaslowB
 
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 MVCAnkit Kashyap
 
Lightweight webdev
Lightweight webdevLightweight webdev
Lightweight webdevdamianofusco
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterPongsakorn U-chupala
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLê Thưởng
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introductionFajar Baskoro
 
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 IRohit Rao
 
Refactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationStephen Fuqua
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesQamar Abbas
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8Thomas Robbins
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017Innovation Studio
 
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.0Mayank Srivastava
 

Ähnlich wie Sitecore mvc (20)

MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
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
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
 
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
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Lightweight webdev
Lightweight webdevLightweight webdev
Lightweight webdev
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Mvc
MvcMvc
Mvc
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniter
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdf
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
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
 
Refactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test Automation
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 
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
 
Module2
Module2Module2
Module2
 

Kürzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Sitecore mvc

  • 2. What we will see today? Areyouexcited? • What is Sitecore MVC • How does it differ from regular .NET MVC? • Using Web forms and MVC within one solution Sitecore • Should we use Sitecore MVC? • Installing and Configuring Sitecore MVC • Renderings • @Html.Sitecore() Helper and creating custom Sitecore helper • Using your own model instead of RenderingModel
  • 3. What is Sitecore MVC? • A View, It is the component that displays the application's user interface (UI) (all of the things the user can see and respond to on the screen, such as buttons, display boxes, and so forth). • A Model, which represents the underlying, logical structure of data in a software application and the high-level class associated with it at data domain. This object model does not contain any information about the user interface and the implementation. • A Controller, which represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.
  • 4. A traditional ASP.NET MVC request
  • 5. Using Web forms and MVC within one solution Sitecore • Yes. We can use both the approach, a traditional web form and even a MVC in a single solution of Sitecore project. • I know you guys will have question, How it will differentiate a traditional Web form request and MVC request in Sitecore?
  • 7. Should we use Sitecore MVC? • Yes • No • Both are true answers. We should ask question instead, When we should use Sitecore MVC?
  • 8. MVC Web Forms • Shorter page lifecycle, better performance • Extra built-in security • Steep learning curve for web forms developers and junior developers • Faster to build, less classes • Easy to add DI and more flexible unit testing • Easier to understand for less seasoned .NET developers * Forces a convention and cleaner coding • Larger knowledge base/ documentation and more tutorials available • RAZOR view engine is very convenient for front-end integration. • More developers out there with experience in coding with web forms & Sitecore • Will be supported by Sitecore going forward (we have confirmed this from the very top) • Will be supported by Sitecore going forward • Helps pull new talent, newer framework (with Sitecore) • Will not be made redundant by MVC any time soon • We would advice that you have a fairly senior .NET development team (That we have, without any doubt). • More Sitecore partners are familiar with web forms, so more support available if short-staffed or something goes wrong • There are some very large Sitecore clients implementing solutions with MVC, some of which are already live. • Tried and tested, most existing Sitecore solutions are built with web forms. • Very stable, MVC has been around with .NET for a long time, there was not a lot of core code Sitecore needed to change to support MVC • Very stable • Good de-coupling from HTML, no need to worry about automatic ID's generated by web-forms controls, resulting in cleaner HTML output. • Fastest approach to get a clean application live for a company with predominantly web forms experience.
  • 9. Renderings Common Renderings • Method Rendering • Url Rendering • Item rendering • Webcontrol • Xsl Rendering MVC specific renderings • View renderings • Controller renderings
  • 10. View Rendering A view rendering consists of a view that takes a RenderingModel by default. The model is assembled by the Sitecore MVC pipeline, and you can create your own, custom models. Because the pipeline expects an Initialize() method on your model, you can either inherit from RenderingModel or implement IRenderingModel. To post a view rendering, specify the controller and action that you want to post to on the component’s definition item. Advantages • They are simple to use – especially if you do not use a custom model. Most of the time, you only want to display some content from the context or data source item without requiring any business logic – a simple ‘page’ will often consist of a title and some text, which you can do very easily with Sitecore’s RenderingModel and the @Html.Sitecore() helper. There isn’t much to unit test here (you can certainly do web tests), and creating a controller action seems extraneous.
  • 11. • When you post a form from a view rendering, it will only post the action you have specified – after which you can redirect to another page or trigger the Sitecore rendering pipeline. This is not the case with controller renderings, which make posting forms a bit more difficult. Disadvantages • If you need to do any business logic when retrieving your model, you will want to do that in a separate layer. However, because you do not have access to a controller, the only place you can do this logic is in the Initialize() method of a custom model – and putting business logic in the model itself is not ideal. • It’s just not very ASP.NET MVC. Developers are used to having a controller and an action, and view renderings do not work like that. However, you must keep in mind that Sitecore MVC is an implementation of ASP.NET MVC that needs to support the same features as its Web Forms counterpart. The modular nature of a Sitecore page introduces challenges.
  • 12. Controller Rendering Rather than specifying a view, the component definition item for a controller rendering specifies a controller name and an action name. When the rendering is added to a placeholder, this action is executed and the view is returned. Advantages • They look ASP.NET MVC. You can use dependency injection and common patterns (like the repository pattern) as you normally would, and create your own actions. • Keeps your business logic separate from your model; you can create plain POCO classes that are hydrated by a business logic layer.
  • 13. Disadvantages • Although they look ASP.NET MVC, they are still renderings and will not behave exactly as a controller action might in a standard ASP.NET MVC application. This is particularly evident when you try to have more than one post on the page, or attempt to RedirectToAction. • They are executed after the main view has already been rendered, which results in some unexpected behavior – again, this might cause some strange behavior when you try to post a form, and with TempData (if you use that). • In some instances, a controller rendering is a lot of unnecessary work
  • 15. References • http://www.hhogdev.com/blog/2012/august/sitecore-mvc-prototype-part1.aspx part - 1 • http://www.hhogdev.com/blog/2012/august/~/link.aspx?_id=F97F95290694409A99655C2F3D90021D& _z=z part – 2 • http://www.hhogdev.com/blog/2012/august/~/~/link.aspx?_id=B8303C775D554C2A82A337FD4AD48B E1&_z=z part – 3 • http://mhwelander.net/2014/05/28/posting-forms-in-sitecore-mvc-part-1-view-renderings/ • http://mhwelander.net/2014/05/30/posting-forms-in-sitecore-mvc-part-2-controller-renderings/ • http://mhwelander.net/2014/06/13/view-renderings-vs-controller-renderings/ • Video Tutorials: • https://www.youtube.com/watch?v=i3Mwcphtz4w part - 1 • https://www.youtube.com/watch?v=dW_rQp9bMmE part – 2
  • 16. Thank You CREATED BY PRATIK SATIKUNVAR