Table of contents
- Configuring Content Providers
- Using ContentProvider for Implementation
- Using PageProviderBase for Implementation
- Searching a Content Provider Instance
- Using Remote Page Provider
Using PageProviderBase for Implementation
Each class that is registered with EPiServer CMS as a page provider must inherit the class EPiServer.Core.PageProviderBase that resides in assembly EPiServer.dll. The base class contains some abstract methods that must be implemented, for example, GetLocalPage, ResolveLocalPage etc. The base class also contains some virtual methods that can/need to be overriden if some capabilities are to be supported, see the Configuring Content Providers section.
The base class also offers some helper methods to work with PageData objects. One such method is InitializePageData which initializes a PageData object with metadata properties and properties given by the specified page type it also set some default values on metadata properties. Another method is SetProperties that set values for properties on a PageData object. Yet another helpful method is GetProperties that extracts data from a PageData object to a Dictionary so it can be passed/stored to some other back-end storage.
Searching a Content Provider Instance
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 inherits PageProviderBase or 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.
Specific Search on a Specific or Many Custom Content Providers
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"; DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);
Search on All Custom Content Providers
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
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.