Share custom module content items between several instances
Hi. For example, I have custom module built with Module Builder or manually (like Products from SDK). Custom module has several content items. Is this possible to store data for this module in the separate database and share it between several Siteinfity instances? This is maybe useful if you have multi-divisional environment. Each division is running on separate instance and some data has to be consolidated in one place.
Thnak you for using our services.
Sitefinity is based on a provider architecture, this way allowing you to develop custom providers and retrieve the data from any desired data source. For the current use case scenario you can either have a central Sitefinity database where your sites will be pulling its data from, or develop a new database and provider that would fetch the data and return it to the system. For more information on the providers concept in Sitefinity I believe you might find the following blog post and documentation article useful.
the Telerik team
Thank you for the reply!
Provided examples show how to setup different providers to access different database. This is clear to me. I can add second connection string in data configuration file. I can add second providers for content modules. I'm not clear how to access content items using first content provider and copy them to other database using second content provider. Lets consider for simplicity Images content module. Can you provide some example (I don't need real working code), just an Idea how to do it from code.
To get items from particular provider you simply have to pass the providerName to the GetManager() method. This way you will operate with imtes from that provider only.Kind regards,
I did a small test using Sitefinity 5.4. Both websites are running on dev. web
server from VS2012. I prepared small video for problem demonstration: http://webbywell.com/actions.swf.html. Problem description below:
I created two websites. A and B.
Uploaded test image in the first website (A).
For the second website (B) I added new connection string to point to another
database to pull out images. Also I created new provider (ww4Images) for
Libraries (I used this post as a guide).
For new provider (ww4Images) I specified two parameters:
connectionString (pointing to new connection string)
After application restart, I was able to see two providers available to select
for images and other content items. If I switch to the second provider I can
see the test image but it is broken (see broken_image.png). It is broken in
Album and Details views.
If I go to the details view and check Link value I see:
Site A: localhost:12350/.../test.jpg (valid)
Site B: localhost:60876/.../test.jpg (broken)
Next step: On site B using ww4Images provider I upload another image (pic.png).
And it shows up just fine on site B in Album and Detail views (see second_image_siteB).
Link values for this image:
- Thumbnail in album: localhost:12350/.../pic.png.tmb (valid)
- Image in Details view: localhost:12350/.../pic.png
Site B: localhost:60876/.../pic.png
Please let me know what I’m missing here. It has to be something about
provider URL name. I have seen another parameter name for Libraries provider
called urlName, I tried to add it, but it doesn't change anything.
Also I can delete image upload in site A from site B using second provider.
One more observation, I can add new image using second provider and this
image becomes available in the in the website.
Actualy, it turns out that having multiple providers for media libraries is not possible at the moment. The reason comes from the fact that metadata for images is stored in the database, so if you pull images from an external database, your project won't have access to the metadata. We have logged a bug on the problem and will do our best to fix it as soon as possible. Please follow the PITS link to track its status:
As a workaround you can setup a DropBox provider, which will allow you to store image in dropbox and your project will be able to pull those images from the same source. You can read more about this option here: