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

Forums / Developing with Sitefinity / Can I use a custom data provider for a built in module?

Can I use a custom data provider for a built in module?

8 posts, 0 answered
  1. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    14 Jan 2014
    Link to this post
    Is it possible to modify the built-in Events module so that it pulls events from my own custom data provider?

    My goal is to have the existing functionality of the built-in Events module and Events widgets but I want to use my own data provider.

    Could I accomplish my goal if I built a custom module and derived from the built-in Events module classes such as EventsModule, EventsManager, EventsDataProvider, and EventsConfig?

    Here's what I've tried so far and it hasn't worked:

    I created my class, MyInertiaDataProvider that derives from EventsDataProvider. I implemented #GetEvents and #GetEvent so that they use my ORM. I made the other methods return null. I overrode #InitializeDefaultData to return true (since the base implementation was problematic and it didn't seem like it was doing anything I needed).

    I added MyInertiaDataProvider to the Events providers similar to how it is described in http://www.sitefinity.com/blogs/antonhristov/posts/anton-hristovs-blog/2011/08/31/quick_and_easy_way_to_extend_the_news_module_by_making_use_of_the_sitefinity_provider_model and set MyInertiaDataProvider as the default provider.

    I restarted the server, visited the backend, and clicked on Content > Events. The events displayed are not coming from my data provider. I checked the Sitefinity error log and there are no errors.
  2. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    14 Jan 2014
    Link to this post
    I found this, http://www.sitefinity.com/developer-network/forums/general-discussions-/custom-event-news-data-providers, which I believe is asking for the same thing I am. The thread there suggests that I can create a custom data provider and it provides a few details on how to do that. However, it doesn't provide enough information for me to get it working.

    Fyi, I'm on Sitefinity 6.2.4910.0
  3. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    16 Jan 2014
    Link to this post
    I'm working with support on this. I'll post here what I find out.
  4. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    17 Jan 2014
    Link to this post
    Support helped me figure one step I was missing. Here's what I had to do to get Events to use my custom data provider:

    1. In the upper left corner you can find the manage site drop down. Choose the manage site option.

    2. The page will list your sites managed by this Sitefinity instance.
    From the action menu of the site you want to use the custom provider
    choose Configure Modules option.

    3. Find the Events module and click on the "Change" link at the "This site can use data from..." column.

    4. If you can see your custom provider listed make sure its checkbox is
    checked and you can also click on the "Make Default" link to set it as a
    default provider. If the provider is not listed there then there is
    probably a issue in the way your registering the provider.
  5. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    17 Jan 2014
    Link to this post
    I've run into several other problems now that Events is using my custom data provider.

    I'm getting MissingDecoratorExceptions. I worked around them by overriding the following methods in my custom data provider: #GetSecurityRoot, #GetSecurityRoot(bool), SecurityRoot property, #GetComment, #GetComments, and #GetComments(Guid). I made them all return either null or an empty IQueryable.

    If I try to set any LString properties on Event, I get the following error:

    Unsupported language "". If you want to support this language, please configure your application accordingly.

    If I don't try to set any LString properties, then visiting Content > Events will show the Event items that my custom data provider returns.
  6. Bonny
    Bonny avatar
    58 posts
    Registered:
    11 Nov 2016
    20 Jan 2014
    Link to this post
    Hello,

    We are looking into your problem. Lets continue the discussion in the ticket you have oppened, since the solution will be found faster this way. Please contact us here if you have any reason to keep this thread oppened.

    Regards,
    Bonny
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    20 Jan 2014 in reply to Bonny
    Link to this post
    Thanks Bonny. I'm only adding what I find out here so that others can make use of what I've learned and hopefully it will help them. Searching the forums has helped me figure out some of my problems and I think it's nice to have any useful information recorded somewhere that's searchable.
  8. Bonny
    Bonny avatar
    58 posts
    Registered:
    11 Nov 2016
    21 Jan 2014
    Link to this post
    Hi,

    I understand. You are right - feel free to share anything useful here.

    Regards,
    Bonny
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
8 posts, 0 answered