4.x API versus 3.7's API

Posted by Community Admin on 05-Aug-2018 22:43

4.x API versus 3.7's API

All Replies

Posted by Community Admin on 12-Dec-2011 00:00

I see where 4.x has a new Fluent API, but has this completely replaced the 3.7 API?

In the process of trying to migrate a site I noticed that several bits of my code were broken. For example:

Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
CmsSiteMapNode sfNode = (CmsSiteMapNode)node;
 
StringBuilder markup = new StringBuilder();
if (sfNode == null)
    return markup;
 
var children = cmsManager.GetPages(sfNode.PageID);
 
foreach (CmsPage child in children)
    //...


That example from a 3.7 custom control is not function in 4.3. I can see where the Telerik.Cms namespace has been replaced with the Telerik.Sitefinity namespace, but even taking that into account that is not enough to resolve this issue. It appears that the CmsPage class no longer exists and that the CmsManager class is gone as well.

Is there any guidance for migrating custom controls to 4.3?

Thanks!

Posted by Community Admin on 12-Dec-2011 00:00

Your best bet is to reference the new Sitefinity 4 documentation, which shows specific examples on working with Pages and Content Module items.

For example, the Querying Pages documentation shows how to retrieve pages using both the native PageManager API (similar to how you did things in 3.x) and the new Fluent API.

If you are trying to get the current page from the control, you can use this code:

var currentNode = Telerik.Sitefinity.Web.SiteMapBase.GetActualCurrentNode();

i hope this is helpful!

This thread is closed