Skip to content
May 27, 2016 / kiranpatils

How I learnt Sitecore MVC?

Challenge:

Before few months back. I started delving in to Sitecore MVC. Before that I knew basics of it. But no hands on. As I was busy with launching other site. Initially when I searched I found the lot of articles and blogs which scared me! You too?! Google can give you results. But which are best and which are not. You can find it out either trying or finding out other folks who already tried and provide good articles. So, while working I took some notes and I promised my self that once I am done I will share with you. So, you may get benefited out of it.

Sounds interesting? You are also searching for something like that? Then go ahead..!

Solution:

As per my practice. I started understanding ASP.NET MVC. Because i always believe in starting from basics. And following links helped me to do so:

  1. http://www.asp.net/mvc/overview/getting-started/recommended-resources-for-mvc
  2. http://www.asp.net/mvc/videos/pluralsight-aspnet-mvc-5-fundamentals
  3. https://mva.microsoft.com/en-US/training-courses/introduction-to-asp-net-mvc-8322?l=nKZwZ8Zy_3504984382
  4. http://www.w3schools.com/aspnet/mvc_intro.asp
  5. http://www.asp.net/mvc/overview/getting-started/mvc-learning-sequence
  6. https://msdn.microsoft.com/en-us/library/dd381612%28v=vs.100%29.aspx
  7. https://msdn.microsoft.com/en-us/library/dd381412%28v=vs.100%29.aspx

Then moved to Sitecore MVC:

  1. http://www.sitecore.net/learn/blogs/business-blogs/technical-trends/posts/2012/06/mvc-and-sitecore-651-overview.aspx
  2. http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2015/02/how-is-sitecore-mvc-different-from-aspnet-mvc.aspx
  3. https://sdn.sitecore.net/upload/sitecore7/72/sitecore_mvc_developer_guide_72-a4.pdf
  4. http://sitecore-community.github.io/docs/sitecore-mvc/
  5. http://sitecore-community.github.io/docs/sitecore-mvc/creating-project/
  6. http://www.joe-stevens.com/2014/08/17/sitecore-mvc-tutorial-creating-your-first-sitecore-mvc-website/
  7. https://github.com/Sitecore-Community/sample-sitecore-mvc

I liked following excerpt from Lars – Especially RCMV and this diagram!

MVC stands for Model, View and Controller, though I have never understood the order of the abbreviation (by my limited intellect, RCMV would have been more appropriate, with a Route being a significant part of the equation).
Essentially, the request lifecycle of MVC is a Route (usually something that parses the http request) points to a Control (some .net code) which generates a Model (object), which is parsed by a View (usually a Razor view).
MVC Request Lifecycle
This approach is distinctly different from Web Forms, because it requires more code plumbing to create the page, and with less automated code reuse. On the other hand, the developer has more rigid control of the code executed on the page, and the data delivered to the output. Also, not to forget, MVC makes unit testing easier as (most of/all) the code usually is executed in the controller part of the lifecycle.

In my opinion, MVC is well suited for web sites with application functionality (e.g. HTML 5 applications).

Okay, enough theory. I know you developers! 🙂 We need some action now. So, thought to look for some quick start application tried lot of things. But few things were out dates or not properly documented. Finally Martina’s video helped me to give a hands on. I strongly recommend you to follow exercise given in tutorial. It will give you good hands on experience. Which will boost your confidence and clarify your concepts a lot!

I faced some challenges in quick start. But life is NULL without challenge. And your best learnings come out of a challenging situation only. Here are few blog posts helped me to come out of it:

  1. http://sitecoreskills.blogspot.in/2014/06/preparing-sitecore-72-and-mvc-in-visual.html
  2. http://www.seanholmesby.com/fixing-visual-studio-intellisense-in-sitecore-mvc-views/ – Especially for Intellisense
    1. If you are using Project and Webroot model then make sure you copy web.config from Sitecore root to project
    2. Make sure Sitecore.MVC is there in reference
    3. Sitecore.MVC and Sitecore.Kernel – Is Copy Local  true
    4. Or final resort copy all webroot/bin assemblies to project/bin
  3. http://stackoverflow.com/questions/24147846/system-web-webpages-html-htmlhelper-does-not-contain-a-definition-for-sitecor/24152053#24152053

MVC is fun! It is like Maths — Once you understand it. You would like to do it again and again!

Further reading:

  1. http://blog.alen.pw/2012/08/learning-sitecore-mvc-part-1.html
  2. http://blog.alen.pw/2012/08/learning-sitecore-mvc-part-2.html
  3. http://www.matthewdresser.com/sitecore/moving-to-sitecore-mvc
  4. http://techitpro.com/sitecore-mvc/http://www.dotnet-tricks.com/Tutorial/mvc/a9P1010113-MVC-Areas-with-example.html
  5. http://www.codeproject.com/Articles/714356/Areas-in-ASP-NET-MVC
  6. https://community.sitecore.net/developers/f/8/t/108s
  7. https://sitecore.unic.com/2015/06/24/the-sitecore-mvc-puzzle

One Comment

Leave a Comment
  1. Abhishek Shrivastava / Mar 24 2017 7:15 pm

    Thank you very much for sharing this!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: