• An Introduction to Page Providers
  • Page Providers in short
  • Custom Page Providers and the PageProviderBase class
  • Integrating the XMLPageProvider
  • Configuration of page providers
  • Further information in SDK
  • See Also
  • An Introduction to Page Providers

    The page provider technology was introduced as part of the EPiServer CMS 5 R2 release. The technology is one way of integrating information into an EPiServer CMS Web site. A sample page provider XMLPageProvider is shipped with EPiServer, aimed at giving inspiration to developers when creating custom page providers.

    An EPiServer Enterprise license is required in order to add your own custom page provider to a commercial solution. However no license check is performed when using WebDev server meaning it is possible to develop custom providers locally without an enterprise license.

    The page provider acts as an intermediary connecting an EPiServer site to an external data source. All the data appears as part of the EPiServer Web site, though in fact the data resides at the data source. The data handled by the page provider can be displayed as EPiServer pages only. There is no default page provider information in the web.config - this information needs to be added manually.

    For further information see the Tech Note on Page Providers.

    Page Providers in short

    Custom Page Providers and the PageProviderBase class

    Each page provider that is registered with EPiServer must inherit from the PageProviderBase class that resides in the EPiServer.dll assembly. When creating custom page providers there are four abstract methods that are required to be implemented:

    GetLocalPage: What is used to pull out one specific page from the data store and return it - a PageData object or an instance of an object that is derived from the PageData class. There are some helper methods in PageProviderBase to initalize and populate PageData objects.

    GetChildrenReferences: Only passing back the page references for all the children to one specific node (the rest EPiServer takes care of - caching, sorting etc).

    Uri ResolveLocalPage(PageReference, out Guid): From a pageReference to a GUID. If the passed in identifier corresponds with an identifier for a page served by the page provider instance then this method should return the internal (“classic” link to the page and the Guid based identifier for the page. This maps to PageLink, PageGUID and LinkUrl properties for a PageData instance.

    Uri ResolveLocalPage(Guid, out PageReference): From a GUID to a pageReference. If the passed in identifier corresponds with an identifier for a page served by the page provider then the implementation should return the internal ("classic") link to the page and set PageReference identifier. The URI can be constructed by helper method ConstructPageUri(Int32, PageReference). This typically maps to PageLink, PageGuid and LinkUrl properties for a PageData instance.

    Integrating the XMLPageProvider

    Here we shall explain how you can add the XMLPageProvider to an EPiServer CMS 6 Web site, You only need to perform a few simple steps in order get the page provider working in the solution. Here with have used the XMLPageProvider as an example:

    Step 1 - Create a page provider entry point:
    Insert a page provider node in the site's page tree (an empty page) - an entry point for the page provider. Note the Page ID which shall be the entry point value in the page provider configuration.

    Step 2 - Add the XmlPageProvider Assembly to the solution:
    Add the assembly XmlPageProvider.dll to the projects references.

    Step 3 - Add the data source:
    The xml-file "externalpages.xml" is available for download in EPiServerWorld prepared as the data storage for this demonstration. The path and file name for the data file is stored in the attribute filePath in the path provider configuration in the web config file.

    Step 4 - Add the configuration to web.config:
    See the configuration of page providers section below.

    Using the page provider
    Now it should be possible to access and manipulate the information in the page provider node in EPiServer. Which actions can be carried out on the page provider node is defined by the capabilities attribute in the configuration. Be careful when moving pages between one page provider to another - when the information is moved into another page provider it is deleted from the old page provider permanently.

    Configuration of Page Providers

    The configuration for page providers is to be placed in the in web.config. See the page providers tech note for information on which capabilities a page provider instance can support. Some attributes are mandatory (name, type, entryPoint) while others are optional (capabilities, iconPath, wastebasketName). It is possible to add extra attributes needed for the page provider type, these will be passed in to the provider instance upon construction of the instance. Here is an example page provider configuration:

    <episerver xmlns="http://EPiServer.Configuration.EPiServerSection">

    ...

    <pageProvider>

    <providers>

    <add name="XmlPageProvider" type="CodeSamples.XmlPageProvider, XmlPageProvider"   entryPoint="26" capabilities="Create,Edit,Delete,Move,Copy" filePath="~\externalpages.xml"/>

    </providers> 

    </pageProvider>

    ...   

    </episerver>

     

    Further information in SDK

    For further information see the SDK framework reference PageProviderBase class methods for some detailed information regarding the XMLPageProvider implementation.

    See Also

    For further information see the Tech Note on Page Providers.