Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Note that this is considered as an advanced development feature.
This document contains functional and technical information about the Content Provider concept. A content provider is a module that when registered with EPiServer CMS can serve the EPiServer CMS site with exteral data as IContent objects (for example PageData instances). An EPiServer CMS site can have several different content provider instances registered with each of them having their own set of configuration data such as capabilities settings, etc.
The registration of a content provider with EPiServer CMS can be done either through configuration in the episerver section of the web.config or programatically through the API interface EPiServer.Core.IContentProviderManager which can be located through IOC container.
Note that the start page, root page and waste basket cannot be delivered via a content provider.
The configuration for content providers is placed in the in web.config. Some attributes are mandatory (name, type) while others are optional (entryPoint, capabilities, iconPath, wastebasketName). It is possible to add extra attributes needed for the content provider type, these will be passed in to the provider instance upon initialization of the instance.
Every class registered as a content provider must inherit the base class EPiServer.Core.ContentProvider, which is based on System.Configuration.Provider.ProviderBase. To register the content provider in the web.config file, 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>
Mandatory attributes are name, type. The entryPoint attribute specifies which existing page in EPiServer CMS will be the root for the content served by the content provider instance. The given entryPoint must not have any existing children in EPiServer CMS. If an entry point is not given data from the content provider will not be seen in the PageTree in edit mode.
It is possible to specify which capabilities the provider instance supports. The available capabilities are:
Several capabilities can be specified by a comma-separated list.
Move between content providers requires that the user has permission for function "Move between page providers".
Each class that is registered with EPiServer CMS as a content provider must inherit the class EPiServer.Core.ContentProvider that resides in assembly EPiServer.dll. The base class contains some virtual methods that can/need to be overriden if some capabilities are to be supported.
To create IContent instances the class EPiServer.Construction.ContentFactory can be used.
If a content provider instance is to be searchable, it must be registered with the Search capability and the class registered must implement FindPagesWithCriteria if it implement IPageCriteriaQueryService if it inherits ContentProvider.
Below is a description on how to call FindPagesWithCriteria depending on which content providers is to be included in the search.
Searching on a specific Custom Content Provider or even many Custom Content providers is done by adding a PropertyCriteria for each Custom Content Provider to PropertyCriteriaCollection.
Name the property EPI:MultipleSearch and the value should be the name of Custom Content Provider. Example:
PropertyCriteriaCollection crits = new PropertyCriteriaCollection();
PropertyCriteria crit = new PropertyCriteria();
crit.Name = "EPI:MultipleSearch";
crit.Value = "CustomKey";
crits.Add(crit);
DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);
Searching on all Custom Content providers can be achieved be by defining only one PropertyCriteria. The name of the PropertyCriteria should be EPI:MultipleSearch and the value should be "*". Example:
PropertyCriteriaCollection crits = new PropertyCriteriaCollection();
PropertyCriteria crit = new PropertyCriteria();
crit.Name = "EPI:MultipleSearch";
crit.Value = "*";
DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);
Search on default content provider is typically the one serving content from the EPiServer CMS database. The Searching will work as before if there is not PropertyCriteria with the name EPI:MultipleSearch.
A Remote Page Provider is used 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: Mar 31, 2014