1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Is there a difference in the ways that the content is returned?

Is there a difference in the ways that the content is returned?

4 posts, 1 answered
  1. Kaine Varley
    Kaine Varley avatar
    13 posts
    Registered:
    25 Aug 2009
    16 Mar 2010
    Link to this post
    Hi,

    I was wondering if there was a difference in the way that the content is returned in the following scenarios:

    NewsManager newsMan = new NewsManager("News");
    foreach (IContent item in newsMan.Content.GetContent(0, 10))
    {
      // Item processing code...
    }

    - and -

    ContentManager contentMan = new ContentManager("News");
    foreach (IContent item in contentMan.GetContent(0, 10))
    {
      // Item processing code...
    }

    Could it be that the NewsManager provides additional benefit? For instance, when using the NewsManager, are the items returned pre-sorted in a News specific order?

    The same could be said for the EventsManager, does this also provide additional benefit over using the ContentManager?

    Thanks,


    Kaine
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Mar 2010
    Link to this post
    Hi Kaine Varley,

    Thank you for using our services.

    There is no difference in the two methods of getting content. Since we use the Provider Model the the manager will call the GetContent method in the provider the manager has been instantiated. In this case it will be the News provider. Basically those two calls will call the same method. NewsManager is a class which is derived from ContentManager, it provides some News module specific additions to the basic manager.

    It is preferable to use the base class (ContentManager) if you are going to work with multiple providers from multiple generic content based modules. However if you need to work only with one module you can use the specific manager for this module.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    16 Mar 2010
    Link to this post
    The eventsmanager does provide an additional wrapper to the IContent items that are returned, as they are returend as IEvent, which includes properties for EventStart and EventEnd. this is handy to avoid having to go through GetMetaData() for these properties...

    I'm only guessing here, but I would imagine that the NewsManager was intended to have the same kind of functionality (properties for ExpirationDate, Summary,  etc), as well as blogs, forums, etc, but only the IEvent has been implemented...

    but the ContentManager of each ProviderManager does appear to be the same as using ContentManager...

    An added benefit of using the XxxxManager is that content added to each provider will automatically be wired up (NewsManager for adding news, EventsManager for adding events, etc)

    hope this was helpful, please correct me if I'm mistaken in any of this!
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Mar 2010
    Link to this post
    Hello SelArom,

    IEvent is actually used so we can bind the events to the RadScheduler. The RadScheduler is working with list of IEvent items, this is the reason why we have for events, and not for news. 

    Kind regards,
    Georgi
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 1 answered