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:
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!