Can I use a custom data provider for a built in module?
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 www.sitefinity.com/.../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.
I found this, www.sitefinity.com/.../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
I'm working with support on this. I'll post here what I find out.
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.
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.
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
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.
Hi,
I understand. You are right - feel free to share anything useful here.
Regards,
Bonny
Telerik