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
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.
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)
Hope that helped you in the right direction.
/Casper Aagaard Rasmussen
Could you also clarify what issues may arise with content providers?
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.
Thanks, I understand your reply and making sure we are using it properly.