One Custom Content Provider to Server different Data For Different Sites

Vote:
 

Hi

Do you know if i can have content provider per site. In our system we have 10 different sites under root folder. The issue is EPiserver is caching the one content provider for each site.

Let say if i have 10 site 

Site 1

Site 2

Site 3

.

.

.

Site 10

If I load Site 3 first then all of the Site will point to RootFolder/EntryPoint of Site 3 as Content Provider has been cached. Do you know how can i resolved the issue?

I want to serve differnt folder structure and and content in custom content provider for each of different sites.

Cheers

Ali, Murtaza

#181099
Edited, Aug 09, 2017 3:48
Vote:
 

Hi Murtaza.

You can consider overriding the SetCacheSettings to customize the caching configuration for your content provider. As an example, you could alter cache keys based on the current SiteDefinition. If you do aren't careful, you may end up with issues in scenarios where your content provider is used outside of a site authoring or site browsing context - e.g. as part of the full Episerver Find indexing.

protected override void SetCacheSettings(IContent content, CacheSettings cacheSettings)
{
	        base.SetCacheSettings(content, cacheSettings);
}

Hope that helped you in the right direction.

/Casper Aagaard Rasmussen

#181141
Aug 09, 2017 15:09
Vote:
 

Hi Casper.Rasmussen

Could you also clarify what issues may arise with content providers?

Cheers

#181254
Aug 15, 2017 3:16
Vote:
 

Hi Murtaza.

Sure thing. Let's say you rely on SiteDefinition.Current within your ContentProvider to decide if you're returning content according to site 1, site 2 or site 3. When the ContentProvider is used outide of site authoring or site browsing, SiteDefintion.Current is either null or equal to the SiteDefinition for your fallback site (the one configured with a * as hostname configuration). If you're using Episerver Find, you will find that to be an issue, since Episerver Find uses your ContentProvider during indexing without being in the context of a given site. 

Hope that added more perspective.

Have a good day.

/Casper Aagaard Rasmussen

#181278
Aug 15, 2017 14:02
Vote:
 

Hi Casper.Rasmussen

Thanks, I understand your reply and making sure we are using it properly.

Cheers

#181446
Aug 21, 2017 1:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.