When porting MVC applications to Sitecore, you have several options available - depending on the nature of the component you are porting, you need to choose the most suitable option.
I will try to answer your 5 specific questions:
1. When to use Razor views
I'm not sure the question is “when to use the Razor view”, or if the questions “when to use Sitecore View Rendering” - I will consider the latter.
A Rendering view is great if you are writing presentation components that do not require any business logic and deal only with rendering elements. If you plan on adding code to your Razor view, you should probably think it would be more appropriate or perhaps customize the mvc.getModel pipeline.
2. Migration gotchas
Some of the things you might catch when porting an MVC application to Sitecore.
- Component Controllers - In MVC, you have one controller per page. Sitecore supports the concept of ControllerRenderings, which allows you to have multiple controllers per page (note: there will always be one route controller, which can be taken as the main one).
- Routing items. Sitecore has access to all the routes that are effective for all the paths that appear on the path to the element. Standard MVC routes and “point routes” can joyfully coexist. Element routes do not currently support route parameters (for example, you cannot specify {action} or other parameters on the element route).
- MVC4 - There is currently no official support for MVC4 (this will not last long, but at the same time see http://herskind.co.uk/blog/2012/10/sitecore-66-mvc4 )
- Areas - Areas are currently not fully supported.
- I don’t know what types of rendering to use, and when to convert existing functionality to components.
3. Pipeline setup
You are not required to configure Sitecore pipelines. I can see some examples where it would be useful to change pipelines in the context of migration history. One example that I recently talked about in the Sitecore user group included the addition of an ActionFilter around the world (via the mvc.resultExecuting pipeline) that would put an ASP.Net MVC application into the Sitecore place holder. In my example, I injected the MVC Music Store into the placeholder and used Sitecore to manage the windows (headers and footers / menus). That way, I could plug in an existing MVC application in Sitecore without changing it.
4. Navigation links
If your navigation endpoints are Sitecore line item routes (for example, the path to an item on a website), you should use Sitecore LinkManager to create the appropriate links. If the endpoints are standard MVC RouteLink and ActionLink , they should work fine.
I think that without a concrete example, the answer will be "possible."
5. A message about the transition to the best training
I don't know any blog posts or articles about Sitecore MVC migration best practices. Keep in mind that full MVC support is a recent addition to Sitecore, and not many have seen this journey from start to finish.
Why and when to convert to Sitecore rendering
You end your question by stating that you are still confused when and why you should convert Razor controls and views to Sitecore rendering. Here are some indicators that something is a candidate for Sitecore rendering:
- This is a component that can be reused on many pages.
- You want to enable Sitecore users to add the component to the pages. (think about the editor)
- You want to use Sitecore component level caching.
- You want to use Sitecore protection to restrict who can use / see the component.
- You want to manage a component using personalization, rules, or run MVT on it.
In the context of MVC, there are some indicators that may be incorrect for converting something to Sitecore rendering:
- It relies heavily on routing and route parameters.
I am sure that many of the points in this answer can be expanded, and I know that there are no clear reduction rules for this, but I hope this answer will help to eliminate some confusion ...