This topic describes the concept of content provider, and how to configure these for Episerver CMS websites.
In this topic
A content provider is a module that when registered with Episerver CMS, can serve the site with external data as IContent objects (for example PageData instances). An Episerver CMS site can have several different content provider instances registered with each having its own set of configuration data, such as capabilities settings, and so on.
You can register a content provider with Episerver CMS through configuration in the episerver section of the web.config, or programmatically through the EPiServer.Core.IContentProviderManager API interface, which is located through IOC container.
Note: A content provider cannot deliver the start page, root page, and waste basket (recycle bin, trash).
You configure content providers in web.config. You can add attributes for the content provider type, which are passed into the provider instance when the instace is initialized. To register the content provider in web.config, add an entry to the configuration element contentProvider as shown in the following example:
<episerver> ... <contentProvider> <providers> <add name="custom" type="CustomServer.PageStore, Custom" entryPoint="52" capabilities="Create,Edit,Delete,Search,Wastebasket"/> </providers> </contentProvider> ... </episerver>
Some attributes are mandatory (name, type) while others are optional (entryPoint, capabilities, iconPath, wastebasketName).
You can specify the following capabilities, if the provider instance supports it. You can specify multiple capabilities with a comma-separated list.
Note: Moving content between content providers requires that the user has permission for the function: "Move between page providers".
Each class registered as a content provider must inherit the EPiServer.Core.ContentProvider base class, which is based on System.Configuration.Provider.ProviderBaseand resides in EPiServer.dll assembly.
Use the EPiServer.Construction.ContentFactory class to create IContent instances.
If you want a content provider instance to be searchable, you must register it with the Search capability, and the registered class must implement FindPagesWithCriteria if it implements IPageCriteriaQueryService and if it inherits ContentProvider.
The following example shows how to call FindPagesWithCriteria, depending on which content providers are to be included in the search. To searching on one or more custom content providers, add a PropertyCriteria for each custom content provider to PropertyCriteriaCollection. Then, name the property EPI:MultipleSearch and the value to the name of custom content provider.
PropertyCriteriaCollection crits = new PropertyCriteriaCollection(); PropertyCriteria crit = new PropertyCriteria(); crit.Name = "EPI:MultipleSearch"; crit.Value = "CustomKey"; crits.Add(crit); DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);
The following example shows how to search on all custom content providers, by defining only one PropertyCriteria and naming it EPI:MultipleSearch with the value "*".
PropertyCriteriaCollection crits = new PropertyCriteriaCollection(); PropertyCriteria crit = new PropertyCriteria(); crit.Name = "EPI:MultipleSearch"; crit.Value = "*"; crits.Add(crit); DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);
If you do not specify PropertyCriteria with the name EPI:MultipleSearch, search occurs on the default content provider, which is typically the one serving content from the Episerver CMS database.
Note: Only the default content provider has a full text search implemented. Episerver does not index (and therefore does not search) content served by custom content providers.
Episerver uses a remote page provider to integrate the content between two installations of Episerver CMS. Pages appear as any local page even when they are managed by a separate installation.
Last updated: Oct 26, 2016