+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

The benefit of having a system built on the provider model

by Grigori Karanikolov

One of the great advantages of Sitefinity is its flexibility and extensibility. A significant contribution for this has been made by the provider model that was chosen as essential part of Sitefinity’s architecture.
In simple words, what it gives you is the ability to connect Sitefinity to different data repositories (databases, xml files, file structure) so that you can pull content from multiple locations and mash it up in your pages. This means that you could simultaneously pull content items (news, events, images, taxonomy, user and role data… virtually anything that Sitefinity interfaces with) from your local Sitefinity database and other locations (your corporate CRM or ERP system or company website for example).

Additionally, providers allow you to have separate Sitefinity websites pull contain from the same data repositories, so that you can create content in one centralized place, and it would be reused by as many instances of Sitefinity as you need.

We will go through the steps to follow in order to achieve that result. First, let’s tackle this scenario:

“We have several websites – a main corporate website and several subsidiary sites for some of our projects. We need to be able to create news and distribute it among all of them rapidly, with no duplication of effort. We should also be able to share categorizations and tags, as we would like to display only specific types of news (corporate news, project news, etc.) by filtering by taxonomy. Is that possible with Sitefinity?”

N.B. This is actual request I’ve received multiple times already.

The answer – just sit and watch!

For the demonstration of that scenario, I’ve set up 2 independent Sitefinity projects (both obtainable from the SDK) – the Telerik International University website and Quantum Laptops online shop.
My goals – creating a news item on the TIU website should automatically create it inside the Quantum site as well, providing the same taxonomy (categories and tags) that I’ve assigned during the creation.
What I need to do in order to achieve my goals:
  • Create a provider inside TIU which would establish the communication between Sitefinity and the data repository – in this case the Quantum website’s database
  • Point this provider to the correct database by adding the required data connection string.
  • For taxonomy sharing, set up the taxonomy provider to point to Quantum's database and access the correct tables by setting the applicationName attribute

For your viewing pleasure, I’ve gone through those steps in this video:



Edit:
Note: One important thing to consider is permissions.
Since permissions are stored in the content item tables, they get carried across the different instances, i.e. are not independent on each Sitefinity website in this scenario. What you could do to ensure that permissions are set correctly on each website that shares providers is to create Roles with the same IDs and assign permissions to these. They will get carried across and work fine.

If you have any questions and comments, please do not hesitate to comment!

8 comments

Leave a comment
  1. Steve Feb 29, 2012
    Oh neat!

      Do you think it would be beneficial to somehow allow sites to talk to each other to evict the cache or refresh the content types instead of losing all the L2 Cache benefits?
  2. Stan Mar 02, 2012
    Awesome! Thanks Grisha!
  3. Craig Mar 02, 2012
    Grisha,  this is a very interesting concept and one we might take advantage of in the future.

    One thing I was wondering was, what if I move my connection strings to my web.config to take advantage of web config transformations?  Is the senario you described still possible or do I have to move my connection strings back into my DataConfig.config file?

    Thanks again.  :-)
  4. Grisha 'Greg' Karanikolov Mar 14, 2012
    @Steve

    that was the first thing that came to my mind and the first question I shot towards the dev team. It turned out that it's doable, we just have to plan, estimate and prioritize it. I've logged it as a feature request, so let's see how this will turn out!

    @Craig
    Good question, Craig! What transformations would you like to have? This might turn out to be a real gem! As far as I know, connection strings can alternatively be kept in the web.config file as well, Sitefinity has a fallback algorithm to look for its connection strings in different locations. Possible locations in order of priority are
    1. data.config file
    2. web.config file.

    So if you move your data connection strings from the data.config to the web.config file
    it should work just as you needed!
  5. Carlos Jun 05, 2014
    Is it possible to share Content Blocks on newer versions? (Sitefinity 6 and 7)
  6. Grisha 'Greg' Karanikolov Jun 06, 2014
    It should be, Carlos - the Content Blocks are following the same pattern, their provider is Telerik.Sitefinity.Modules.GenericContent.Data.OpenAccessContentProvider, Telerik.Sitefinity so you could give it a shot!
  7. Carlos Jun 09, 2014

    Yes, it is possible!

    The value pair settings for the Content blocks are:

    Under Advanced Settings, Content:
    .   Key: applicationName
    .   Value: /Generic_Content

    Thanks for sharing this tutorial!

  8. Grisha 'Greg' Karanikolov Jun 12, 2014
    Glad you figured this out and made it work, Carlos! Cheers!

    Leave a comment