Best practice for migrating MVC web to Sitecore - sitecore

We have a couple of MVC 3.0 web application some of them combination of Web Form and MVC3.0 within on project/solution.
I'm quiet new to sitecore, could someone please help me understand following in regards to migrating the existing application to Sitecore?
On what type of scenarios should we move MVC3.0 razor views to sitecore?
What are the key gotchas migrating MVC3.0 to sitecore?
Do I need to inject anything on sitecore pipeline?
Do I need to change any of the navigation links to work under sitecore?
Any link to sitecore best practice for migrating existing web app will be good.
I followed the blog below and still unclear why and when should we convert web control and razor views to Sitecore Rendering.
Thank you.

When migrating MVC applications into a Sitecore solution you have a few options available - depending on the nature of the component you are migrating you would have to choose the most appropriate option.
I'll try and address your 5 specific questions:
1. When to use Razor views
I'm not sure if the question is "when to use a Razor view" or if the questions is "when to use Sitecore View Rendering" - I'll assume the latter.
A View Rendering is great if your are writing presentation components that do not require any business logic and only deals with rendering items. If you are contemplating adding code in your Razor view you should probably consider if a Controller Rendering would be more appropriate or perhaps customising the mvc.getModel pipeline.
2. Migration gotchas
Some of the things that may catch you out when migrating a MVC application to Sitecore.
Component based controllers - in MVC you have one controller per page. Sitecore supports the concept of ControllerRenderings that allows you to have multiple controllers on a page (note: there will always be one route controller that can be perceived as the primary).
Item routing - Sitecore has a catch all route that is effective for all paths that map to an item path. Standard MVC routes and "item routes" can happily coexist. Item routes do not currently support route parameters (e.g. you cannot specify {action} or other parameters on the item route).
MVC4 - Currently no official support for MVC4 (this won't hold true for long - but in the meantime have a look at http://herskind.co.uk/blog/2012/10/sitecore-66-mvc4)
Areas - Currently areas are not fully supported.
Not knowing what rendering types to use and when to convert existing functionality into components.
3. Pipeline customisation
You are not compelled to customise the Sitecore pipelines. I can see a few examples where it would be useful to modify pipelines in the context of a migration story. One example I recently talked about at a Sitecore User Group involved adding a ActionFilter globally (through mvc.resultExecuting pipeline) that would inject a ASP.Net MVC application into a Sitecore place holder. In my example I injected the MVC Music Store into a placeholder and had Sitecore control window dressing (headers/footers/menus). This way I could bring my existing MVC application into Sitecore without having to change it much.
4. Navigation links
If your navigation endpoints are Sitecore item routes (e.i. the path to an item on the website) you should use Sitecore's LinkManager to generate the appropriate links. If the endpoints are standard MVC routes RouteLink and ActionLink should work just fine.
I guess without a concrete example the answer will be "maybe".
5. Best practice migration blog post
I'm not aware of any blog posts or articles dealing with Sitecore MVC migration best practice. Keep in mind that full MVC support is a recent addition to Sitecore and not many seen this journey from start to end yet.
Why and when to convert to Sitecore Rendering
You end your question stating that you are still confused about when and why you would convert controls and Razor views to Sitecore renderings. Here are some indicators that something is a candidate for being a Sitecore rendering:
It is a component that can be reused on many pages.
You want to enable Sitecore users to add the component to pages. (think Page Editor)
You want to leverage Sitecore's component level caching.
You want to leverage Sitecore security to restrict who can use/see the component.
You want to control the component with personalisation, rules or run MVT on it.
In the context of MVC here are some indicators that it may not be right to convert something to a Sitecore rendering:
It relies heavily on routing and route parameters.
I'm sure many of the points in this answer could be expanded on and I know that there are no clear cut rules for this - but I hope this answer helps clear up some of the confusion...

Related

Bulk Creation Of Items In Sitecore

I am using Sitecore 8, Update 3.
I am attempting to bulk create a couple thousand items that use a custom template. All of these items are created under one specific parent item.
The custom template has two fields which are Path [Single-Line Text] and Target [General Link].
The source of the data is in an old SQL database.
Is there a way to do this?
The Sitecore marketplace module Data Importer is a option for you.
Create a custom importer with the sitecore api is also possible, to speed up, you can disable the index rebuild.
Since your data is already in SQL Serve, you should take a look at using the SSIS Components for Sitecore, it was designed for importing exactly this kind of data in bulk into Sitecore using ETL.
You can find more info in the blog post Creating your first project with SSIS Components for Sitecore and there is also some good additional into in the Migrating to Sitecore: Going from WordPress to Sitecore with SQL Server Integration Services (SSIS) post.
The Integration Services Components for Sitecore is available on the Sitecore Marketplace, and it is compatible with Sitecore XP8.
I'll also add, if you are creating anything more than 100 items below a single parent item then this is not recommended Sitecore practice unless the items sit within an Item Bucket. Make sure you account for this, or split your items up into smaller sub-folders (e.g. year/month folders for news article type items)
In these scenarios you normally end up writing code to call the api and create the items programmatically rather than doing a generic import.
If you need to create a large amount of items I would recommend writing a console app to do this. You could use the Sitecore Item Web api to create items outside of the Sitecore context or investigate the new Entity Service api in Sitecore, both will be capable of creating large amounts of Sitecore items.
http://mikerobbins.co.uk/2015/01/06/entityservice-sitecore-service-client/
https://sdn.sitecore.net/upload/sdn5/modules/sitecore%20item%20web%20api/sitecore_item_web_api_developer_guide_sc65-66-usletter.pdf
If these don't float your boat you could always write async code to create the Sitecore items and have that executed by an aspx page in a Sitecore instance - works well for one off tasks.
Example of Asynchronous page processing in ASP.net webforms (.NET 2.0)

How do I add custom entities to Typo3 CMS?

In my project I need to add a lot of custom entities to Typo3 CMS.
Eg. I need to have Buildings, Building Companies, Architects, Certifications, and so on.
What is the common approach for doing this?
Should I develop a new extension?
How can I then have a custom backend for managing these entities? Eg. in the Buildings admin page I want to be able to add a new Building also associating one or more Architects to it. Is it feasible? How?
Can I create a custom backend field for looking up Architects in the Buildings admin page? (eg. something like StackOverflow tags system, a token input field which looks up for items in Architects table in real-time while editing a Building)
To map a business model into Typo3 I prefer to build an extension for that.
On the one hand you have the maximum flexibility by programming in PHP with the help of the Typo3 framework and on the other hand most of the backend management pages come in easy when using the standard MVC + TCA structure of Typo3 Extbase extensions (if it is your first try with Extbase you might want to have an Extbase book at hand).
You can have a look at the Typo3 TCA page to see which standard backend field types are available - there are shown a lot of example configurations. As in your case you might want to use a select field with property "size" > 1 and property "maxitems" > 1 to describe the relation between buildings and architects. As for the architects filter feature you might also want to add the property "enableMultiSelectFilterTextfield" as shown in this example.

Which one is the Right Approach - Re Using Page Layouts or adding Web parts directly to pages instead of page layouts in SP 2013 online site?

I am SharePoint 2013 developer. Before asking question I would like to explain the requirement in clarity.
We are developing one O365 SharePoint online site which is having 10 different page layouts with different and some common web parts and we are reusing these page layouts by deploying a sandboxed solution which is having page layouts. These page layouts contain filter and query to display data using some condition and predefined values. By using these layouts we have to create 100+ pages. All pages will show data according to that page name and category (if it belongs any). We have not written any code to develop the site, everything is OOB feature.
We have used below feature/list/lib of SP Online 2013:
- Document Library
- Survey
- Calendar
- Lists
- Discussion forum library
- OOB Search feature
Now, I would like to know whether this is the right approach to reuse the page layouts. Or can we add webparts directly where the logic resides in the web parts and add them to the pages instead of page layouts?
Also how to deploy page layouts/pages from one server to another? Currently we are deploying everything as a feature using sandbox solution.
Could you please let me know the right approach to follow. I am asking this question because we are facing below issues:
- Sometime page layouts gets corrupted, showing nothing.
- All written filters/logic disappear when we open layouts in Designer
- Deployment is pain using Sandbox solution
Waiting for your reply.
Thanks in Advance,
Shifa Mittal
As you already know developing a custom feature which deploys your web part to the Sharepoint O365 environment is a good idea.
As you have already faced some issues with the Page layouts like got corrupted and not displaying any data is also a thing to be considered. One more thing is to open the Page layuout will require Designer as well and that is the another major thing to be consider.
If you create a webpart which has all the logic of displaying the data in it is better with several advantages of writing your code and reusing it as per your requirement.
So my vote goes with Writing you Sandboxed solution with custom web part with all the logic in it. Though it has some complications but once it is written you can manage it easily on the server and easily debug it as well.
Please correct me if I have missed something
Thanks

Can Velocity or Freemarker template be used for VIEW of Custom plugin portlet?

I am trying to have a custom plugin portlet in liferay for which I can customize the view page with velocity or free-marker template like we have for Asset Publisher in Liferay 6.2.
Requirement
I have a screen for admin (CRUD) through which data would be added in my custom tables through this portlet and then there is a VIEW page for all other users.
Now this portlet can be deployed on different sites or different pages with page-scope and the requirement is that it should have a different look & feel for different pages. Currently we are handling this scenario through deploying different themes to configure the look & Feel of the portlet, but we also need some layout changes which is a limitation with themes.
So I was thinking if we can utilize something similar to a velocity template for the View page but I am not sure where to start and whether liferay provides some easy way to do this. So that we create a template and upload it in the configuration and the VIEW page UI is changed.
I would be grateful if there are some pointers to help me in this direction or atleast can say about the feasibility part of it or an alternative.
Thanks
Environment: Liferay 6.2 GA1

Where are stylesheets typically stored in Sitecore 6.2

I'm taking over the day to day maintenance of a sitecore 6.2 installation for a corporate website. The vendor that originally designed and constructed it are no longer available to contact for information. Also, no documentation has been written on how it was designed or constructed.
My asp.net skills are good and I do have some understanding and exposure to Sitecore and will be attending training soon but in the meantime can anyone give me some ideas as to where a vendor would put the stylesheets that control the design and layout of a Sitecore website.
There's no specific location, its up to the developer. Sitecore is a CMS that needs to be integrated into a custom solution. Part of that custom solution gives the developer the option to put the CSS wherever he/she wants. Best idea: right-click, view source and look for the path(s) to CSS files.
To help you better understand the basics of presentation architecture, take a look at a Very Simple Web Site documents on the Sitecore Developer Network. Also review the Fundamental Concepts document.
Essentially, you can have your style sheets wherever you want (i.e. CSS folder), but you'll usually find reference to style sheets in a Sitecore Layout. Often, developers will use a presentation component to retrieve the file reference from a field that stores the CSS file path in a Sitecore Item. A Sitecore Layout is an item of type layout in the content tree and an .ASPX file.
Make sure you know how Sitecore references media stored in the media library for CSS. Also look for forum posts on how to handle CSS references for Rich Text Fields.
Depending on your deployment systems architecture, there are other considerations for working with style sheets. One is publishing. If you publish from an authoring environment to a live website environment, you’ll want to make sure you copy your CSS files and any other file system references (like media NOT in the media library). This can be accomplished through the staging module. If your using Sitecore CMS 6.3, there are newer approaches.