Try our conversational search powered by Generative AI!

Class PageProviderBase

The base class for a Page Provider.

Inheritance
System.Object
PageProviderBase
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 7.19.2
Syntax
[Obsolete("This type is not being used anymore, please inherit from EPiServer.Core.ContentProvider instead")]
public abstract class PageProviderBase : ProviderBase, IPageStore, IPageResolver
Remarks

A Custom Page Provider registered with EPiServer must inherit from this base class. The PageProviderBase class provides many services for the custom page provider, such as caching, but it is possible for the custom Page Provider to override most of the default implementations.

Constructors

PageProviderBase()

Initializes a new instance of the PageProviderBase class.

Declaration
protected PageProviderBase()

PageProviderBase(IContentRepository, IPermanentLinkMapper, ServiceAccessor<IContentTypeRepository>, IContentDataFactory<PageData>, IPageDataBuilder, ILanguageBranchRepository, IContentProviderManager, TemplateResolver)

Initializes a new instance of the PageProviderBase class.

Declaration
protected PageProviderBase(IContentRepository contentRepository, IPermanentLinkMapper permanentLinkMapper, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryAccessor, IContentDataFactory<PageData> pageDataFactory, IPageDataBuilder pageDataBuilder, ILanguageBranchRepository languageBranchRepository, IContentProviderManager pageProviderManager, TemplateResolver templateResolver)
Parameters
Type Name Description
IContentRepository contentRepository

The page repository.

IPermanentLinkMapper permanentLinkMapper

The permanent link mapper.

ServiceAccessor<IContentTypeRepository> contentTypeRepositoryAccessor

The content type repository.

IContentDataFactory<PageData> pageDataFactory

The page repository.

IPageDataBuilder pageDataBuilder

The page data builder.

ILanguageBranchRepository languageBranchRepository

The language branch repository.

IContentProviderManager pageProviderManager

The page enterprise service.

TemplateResolver templateResolver

The template resolver that is used to resolve template/controller.

Properties

Capabilities

Gets the capabilities that this page provider instance support. The base class implementation will during its initialization read the passed in configuration values (Parse them to enum PageProviderCapabilities) and set the capabilities for the provider instance according to the passed in configuration values.

Declaration
public virtual PageProviderCapabilities Capabilities { get; }
Property Value
Type Description
PageProviderCapabilities

The capabilities.

ContentTypeRepository

Gets the content type repository to use.

Declaration
protected IContentTypeRepository ContentTypeRepository { get; }
Property Value
Type Description
IContentTypeRepository

The content type repository.

DataFactory

The IContentRepository instance being used.

Declaration
protected IContentRepository DataFactory { get; }
Property Value
Type Description
IContentRepository

EntryPoint

Gets the entry point which serves as root for this page provider instance.

Declaration
public PageReference EntryPoint { get; }
Property Value
Type Description
PageReference

The entry point.

Remarks

The default page provider (the one registered with key String.Empty) will not have a EntryPoint since it is the default provider. That provider will return PageReference.EmptyReference.

IconPath

Gets the icon path definied for the page provider.

Declaration
public string IconPath { get; }
Property Value
Type Description
System.String

The icon path.

Remarks

Will be shown in page tree to distinguish pages served by this page provider instance. The value is given by specifiying attribute "iconPath" in provider configuration. The path given should be relative the theme folder "/Images/ExplorerTree/PageTree/".

Examples

If the icon custom.gif is placed in folder App_Themes/Default/Images/ExplorerTree/PageTree value given on configuration attribute iconPath should be custom.gif.

IsDefaultProvider

Gets a value indicating whether this instance is the default provider.

Declaration
public bool IsDefaultProvider { get; }
Property Value
Type Description
System.Boolean

True if this instance is default provider; otherwise, false.

LanguageBranchRepository

Gets the language branch repository.

Declaration
protected ILanguageBranchRepository LanguageBranchRepository { get; }
Property Value
Type Description
ILanguageBranchRepository

The language branch repository.

ListingFetchCacheHits

Counts calls into the PageProviders cache for the children fetching.

Declaration
public int ListingFetchCacheHits { get; }
Property Value
Type Description
System.Int32

ListingFetchCount

Counts the total fetching into the database and cache for children pages.

Declaration
public int ListingFetchCount { get; }
Property Value
Type Description
System.Int32

ListingFetchDatabaseReads

Counts calls into the PageProvider for the children fetching.

Declaration
public int ListingFetchDatabaseReads { get; }
Property Value
Type Description
System.Int32

Name

Gets the friendly name used to refer to the provider during configuration.

Declaration
public override string Name { get; }
Property Value
Type Description
System.String

PageDataBuilder

Gets the page repository to use.

Declaration
protected IPageDataBuilder PageDataBuilder { get; }
Property Value
Type Description
IPageDataBuilder

The page repository.

PageDataFactory

Gets the page repository to use.

Declaration
protected IContentDataFactory<PageData> PageDataFactory { get; }
Property Value
Type Description
IContentDataFactory<PageData>

The page repository.

PageFetchCacheHits

Counts calls into the PageProviders cache for the page fetchings.

Declaration
public int PageFetchCacheHits { get; }
Property Value
Type Description
System.Int32

PageFetchCount

Counts the total fetching into the database and cache for pages.

Declaration
public int PageFetchCount { get; }
Property Value
Type Description
System.Int32

PageFetchDatabaseReads

Counts calls into the PageProvider for page fetchings.

Declaration
public int PageFetchDatabaseReads { get; }
Property Value
Type Description
System.Int32

PageFolderVirtualPathProvider

Gets or sets the page folder virtual path provider.

Declaration
public virtual VirtualPathProvider PageFolderVirtualPathProvider { get; set; }
Property Value
Type Description
System.Web.Hosting.VirtualPathProvider

The page folder virtual path provider.

PageProviderManager

Gets the page provider manager.

Declaration
protected IContentProviderManager PageProviderManager { get; }
Property Value
Type Description
IContentProviderManager

The page provider manager.

Parameters

Gets the configuration parameters for the page provider.

Declaration
public NameValueCollection Parameters { get; }
Property Value
Type Description
System.Collections.Specialized.NameValueCollection

The parameters.

PermanentLinkMapper

Gets or sets the permanent link mapper that can be used to map from PageReference to GUID.

Declaration
public IPermanentLinkMapper PermanentLinkMapper { get; set; }
Property Value
Type Description
IPermanentLinkMapper

The permanent link mapper.

ProviderCacheKey

Gets the provider cache key.

Declaration
public string ProviderCacheKey { get; }
Property Value
Type Description
System.String

The provider cache key.

ProviderKey

Gets the provider key that this PageProvider instance has. It is unique for the EPiServer instance. This is the value that is set on ProviderName on each ContentReference served by this provider instance.

Declaration
public string ProviderKey { get; }
Property Value
Type Description
System.String

The provider key.

StatisticsCollectedSince

Returns the statistics last start date and time.

Declaration
public DateTime StatisticsCollectedSince { get; }
Property Value
Type Description
System.DateTime

SupportedVirtualPathProvider

Gets or sets the supported virtual path provider.

Declaration
public virtual List<VirtualPathProvider> SupportedVirtualPathProvider { get; set; }
Property Value
Type Description
System.Collections.Generic.List<System.Web.Hosting.VirtualPathProvider>

The supported virtual path provider.

TemplateResolver

Gets or sets the control resolver.

Declaration
protected TemplateResolver TemplateResolver { get; }
Property Value
Type Description
TemplateResolver

The control resolver.

WastebasketReference

Gets the reference to the trash can (waste basket) for the page provider.

Declaration
public virtual PageReference WastebasketReference { get; }
Property Value
Type Description
PageReference

The trash can.

Remarks

The base implementation will return PageReference.WasteBasket for the default provider and a PageReference with integer-based ID -1 and RemoteSite = ProviderKey.

Methods

AddChildrenListingToCache(PageReference, PageReferenceCollection, String, String[])

This method is typically not needed to call explicitly, the base class implementation will take care of adding the listing to cache after the listing has been delivered from GetChildrenReferences.

Declaration
protected void AddChildrenListingToCache(PageReference pageLink, PageReferenceCollection children, string cacheKey, params string[] dependencyCacheKeys)
Parameters
Type Name Description
PageReference pageLink

The page link.

PageReferenceCollection children

The children.

System.String cacheKey

The key used to cache the page reference collection of child pages.

System.String[] dependencyCacheKeys

Cache dependencies for the child page reference listing.

Remarks

Override SetCacheSettings to set cache timeouts or add additional dependencies.

AddPageToCache(PageData)

Adds a PageData object to cache with default cache behavior.

Declaration
protected void AddPageToCache(PageData page)
Parameters
Type Name Description
PageData page

The page to add to cache

Remarks

This method is typically not needed to call explicitly, the base class implementation will take care of adding the page to cache after the page has been delivered from GetLocalPage.

A language version of a page is stored with a dependency to a "common" cache entry. That is to make it possible to store languages of pages independent of each other but still be able to remove all languages of a page at the same time. Also the page that is the master language is stored both with and without language information in the cache key meaning if a page is requested without language information the master version is returned.

Override SetCacheSettings to set cache timeouts or add additional dependencies

AllocateUniquePageFolderId(PageReference, PageReference)

Decides whether a unique page folder ID should be assigned for the page. This method is called both when a new page is created through IPageRepository.GetDefaultPageData and when an external page is initalized through call to InitializePageData. Parameter pageLink can be used to decide which case method is called from.

Default implementation returns true if provider has capability PageFolder else false.

Declaration
public virtual bool AllocateUniquePageFolderId(PageReference pageLink, PageReference parentLink)
Parameters
Type Name Description
PageReference pageLink

The page to assign a page folder for. In case of a new unsaved page value is PageReference.Empty

PageReference parentLink

The link to the parent page.

Returns
Type Description
System.Boolean

An value indicating whether a unique page folder should be allocated for page in Page Folder VPP.

Remarks

If the page already have a page folder allocated (for example, it has already one created and that folder ID is stored in backing storage) then this method should return false. Existing value can then be set to property PageFolderID before returning page from GetLocalPage.

ClearProviderPagesFromCache()

Remove all pages served from this provider from the cache.

Declaration
public void ClearProviderPagesFromCache()

ConstructLocalPageReference(Int32)

Creates a PageReference instance with RemoteSite property set with ProviderKey.

Declaration
protected PageReference ConstructLocalPageReference(int id)
Parameters
Type Name Description
System.Int32 id

The page ID.

Returns
Type Description
PageReference

A PageReference for the specified page ID.

ConstructLocalPageReference(Int32, Int32)

Creates a PageReference instance with RemoteSite property set with ProviderKey.

Declaration
protected PageReference ConstructLocalPageReference(int id, int pageVersion)
Parameters
Type Name Description
System.Int32 id

The page ID.

System.Int32 pageVersion

The Version ID.

Returns
Type Description
PageReference

A PageReference for the specified page ID and version ID.

ConstructPageReference(Int32)

Creates a PageReference instance with RemoteSite property set with ProviderKey. If EntryPoint.Id is passed in as parameter then RemoteSite property will not be set.

Declaration
protected PageReference ConstructPageReference(int id)
Parameters
Type Name Description
System.Int32 id

The page ID.

Returns
Type Description
PageReference

A PageReference for the specified page ID.

Remarks

The difference with ConstructLocalPageReference is that this method will take EntryPoint into consideration.

ConstructPageReference(Int32, Int32)

Creates a PageReference instance with RemoteSite property set with ProviderKey. If EntryPoint.Id is passed in as parameter then RemoteSite property will not be set.

Declaration
protected PageReference ConstructPageReference(int id, int pageVersion)
Parameters
Type Name Description
System.Int32 id

The page ID.

System.Int32 pageVersion

The Version ID.

Returns
Type Description
PageReference

A PageReference for the specified page ID and version ID.

Remarks

The difference with ConstructLocalPageReference is that this method will take EntryPoint into consideration.

ConstructPageUri(Int32, ContentReference, Guid)

Creates an URI given a page type, a page link and a pageGuid.

Declaration
protected Uri ConstructPageUri(int contentTypeId, ContentReference contentLink, Guid contentGuid)
Parameters
Type Name Description
System.Int32 contentTypeId

The content type ID.

ContentReference contentLink

The page link.

System.Guid contentGuid

The page GUID.

Returns
Type Description
System.Uri
Remarks

For MVC templates the URI will be in permanent link format.

ConstructPageUri(Int32, PageReference)

Creates an URI given a page type and a page link.

Declaration
[Obsolete("Use overload that takes a pageGuid as well. For MVC pages PageUri will be in PermanentLinkFormat", true)]
protected Uri ConstructPageUri(int pageTypeId, PageReference pageLink)
Parameters
Type Name Description
System.Int32 pageTypeId

The page type ID.

PageReference pageLink

The page link.

Returns
Type Description
System.Uri

Copy(PageReference, PageReference, Boolean, Boolean)

Copy a page to another container served by the same page provider.

Declaration
public virtual PageReference Copy(PageReference pageLink, PageReference destinationLink, bool publishOnDestination, bool allowThreading)
Parameters
Type Name Description
PageReference pageLink

The link to the page to copy.

PageReference destinationLink

The container where the page will be copied.

System.Boolean publishOnDestination

If the new pages should be published on the destination.

System.Boolean allowThreading

Run the local copy process on a separate thread (does not work for remote sites).

Returns
Type Description
PageReference
Remarks

Copy between page provider instances is to be seen as a Create at destination provider. If copy is to be supported this method needs to be overriden.

Note! When a page is copied successfully the CreatedPage event is fired, since a page is created in the copy process. But in contrast to the Save method, that also fires the CreatedPage method and always passes an initialized PageData object in the PageEventArgs object to the event handler, the Copy method does not. Instead it only passes a pagereference to the copied page and it is up to the handler to load the page data. The reason for this behavior in the Copy method is performance.

Examples

The following code sample is an implementation of Copy() for XmlPageProvider:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Copy with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Copy functionality.

Copy(PageReference, PageReference, Boolean, Boolean, AccessLevel)

Copy a page to another container served by the same page provider.

Declaration
public virtual PageReference Copy(PageReference pageLink, PageReference destinationLink, bool publishOnDestination, bool allowThreading, AccessLevel requiredSourceAccess)
Parameters
Type Name Description
PageReference pageLink

The link to the page to copy.

PageReference destinationLink

The container where the page will be copied.

System.Boolean publishOnDestination

If the new pages should be published on the destination.

System.Boolean allowThreading

Run the local copy process on a separate thread (does not work for remote sites).

AccessLevel requiredSourceAccess

The required source access to check access against

Returns
Type Description
PageReference
Remarks

To be backward compatible the base class implementation calls the overload without requiredSourceAccess.

CreateLanguageBranch(PageReference, ILanguageSelector)

Create a page language in storage. Base class implementation will return a writable PageData object initialized for the specified language and the page type given by the master language version of the page.

Declaration
public virtual PageData CreateLanguageBranch(PageReference pageLink, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The link to the page to create a language branch for.

ILanguageSelector selector

The language to create.

Returns
Type Description
PageData

A PageData object with the newly created page data.

Delete(PageReference, Boolean)

Delete a page from storage.

Declaration
public virtual void Delete(PageReference pageLink, bool forceDelete)
Parameters
Type Name Description
PageReference pageLink

The link to the page which will be deleted.

System.Boolean forceDelete

Delete page even if being linked by other pages.

Remarks

If delete is to be supported, this method needs to be overriden.

Examples

The following shows an example of implementation for Delete:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Delete with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Delete functionality.

Delete(String, SecurityEntityType)

Deletes the specified user or role name.

Declaration
public virtual void Delete(string userOrRoleName, SecurityEntityType entityUserRole)
Parameters
Type Name Description
System.String userOrRoleName

Name of the user or role.

SecurityEntityType entityUserRole

The entity user role.

DeleteChildren(PageReference, Boolean)

Deletes children of a page. If delete is to be supported, this method needs to be overriden.

Declaration
public virtual void DeleteChildren(PageReference pageLink, bool forceDelete)
Parameters
Type Name Description
PageReference pageLink

The children of this page will be deleted.

System.Boolean forceDelete

Delete page even if referenced by other pages.

Examples

The following shows an example of implementation for DeleteChildren:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Delete with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Delete functionality.

DeleteLanguageBranch(PageReference, String)

Deletes a language branch for a page.

Declaration
public virtual void DeleteLanguageBranch(PageReference pageLink, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The link to the page which will be deleted.

System.String languageBranch

The language branch to delete.

Remarks

If delete is to be supported, this method needs to be overriden.

Note that you cannot delete the master language branch.

Examples

The following code sample is an implementation of DeleteLanguageBranch() for XmlPageProvider:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Delete specific Language with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Delete specific Language.

DeleteVersion(PageReference)

Deletes a single version of a page.

Declaration
public virtual void DeleteVersion(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

Link to the page and version which will be deleted.

Remarks

If versioning is to be supported, this method needs to be overriden. The published version of page cannot be deleted.

Examples

The following code sample is an implementation of DeleteVersion() for XmlPageProvider:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Delete Version with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Delete Version.

FindAllPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Search for pages that fulfil specific criteria. Will ignore access rights. If the provider is to be searchable, this method needs to be overriden.

Declaration
public virtual PageDataCollection FindAllPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, string languageBranch, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The root page for which the search will be performed.

PropertyCriteriaCollection criterias

The criterias for pages.

System.String languageBranch

Only search for pages on specific language branch.

ILanguageSelector selector

A language selector used to determine the language of pages to return.

Returns
Type Description
PageDataCollection

A collection of pages that fulfil the criteras, will be empty if no match is found.

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for search with the Capabilities property, but does not override FindPagesWithCriteria method.

System.NotSupportedException

Thrown if the Page Provider does not support Search functionality.

FindPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Searches for pages that fulfil specific criteria. If the provider is to be searchable, this method needs to be overriden.

Declaration
public virtual PageDataCollection FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, string languageBranch, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The root page for which the search will be performed.

PropertyCriteriaCollection criterias

The criterias for pages.

System.String languageBranch

Only search for pages on specific language branch.

ILanguageSelector selector

A language selector used to determine the language of pages to return.

Returns
Type Description
PageDataCollection

A collection of pages that fulfil the criteras, will be empty if no match is found.

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for search with the Capabilities property, but does not override FindPagesWithCriteria method.

System.NotSupportedException

Thrown if the Page Provider does not support Search functionality.

Get(ContentReference)

Gets the specified content security descriptor object for the requested content link.

Declaration
public virtual IContentSecurityDescriptor Get(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
IContentSecurityDescriptor

GetChildren(PageReference, ILanguageSelector, Int32, Int32)

Retrieves the children for a specific page. The base class implementation will check for the list of references in the cache. If not found it will call GetChildrenReferences(PageReference, String, Int32, Int32). It will then try to load the pages from cache. For those pages not found in cache it will call GetPages(PageReferenceCollection, ILanguageSelector).

Declaration
public PageDataCollection GetChildren(PageReference pageLink, ILanguageSelector selector, int startIndex, int maxRows)
Parameters
Type Name Description
PageReference pageLink

List children of this page.

ILanguageSelector selector

Select language for page.

System.Int32 startIndex

start index if indexing. -1 indicates no indexing is used.

System.Int32 maxRows

Max number of rows to return. -1 means all rows should be returned.

Returns
Type Description
PageDataCollection

The children for the requested page.

GetChildrenReferences(PageReference, String)

Should return references to all children of the specific page.

Declaration
protected abstract PageReferenceCollection GetChildrenReferences(PageReference pageLink, string languageID)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.String languageID

The language ID.

Returns
Type Description
PageReferenceCollection

Reference to all children.

Remarks

This is expected to return all children regardless of languages. Parameter languageID (if given) can be used to sort on language occurance.

Examples

The following code sample is an implementation of GetChildrenReferences() for XmlPageProvider:

GetChildrenReferences(PageReference, String, Int32, Int32)

Gets the children references for the specified page.

Declaration
public PageReferenceCollection GetChildrenReferences(PageReference pageLink, string languageID, int startIndex, int maxRows)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.String languageID

The language ID.

System.Int32 startIndex

The start index.

System.Int32 maxRows

The maximum number of rows to return.

Returns
Type Description
PageReferenceCollection

The children references

Remarks

The implementation will look in the cache if the listing is present, if so the list is returned from there. If not present it will call current providers method GetChildrenReferences.

GetChildrenReferencesAndTypes(ContentReference, String, out Boolean)

Gets the children references and types.

Declaration
public virtual IList<GetChildrenReferenceResult> GetChildrenReferencesAndTypes(ContentReference contentLink, string languageID, out bool languageSpecific)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.String languageID

The language ID.

System.Boolean languageSpecific

if set to true [language specific].

Returns
Type Description
System.Collections.Generic.IList<GetChildrenReferenceResult>
Remarks

This should be overloaded to be able to support typed GetChildren<T>(ContentReference) where T is a subtype to PageData. Default implementation will call GetChildrenReferences(PageReference, String) and set ModelType to typeof(PageData) for all results.

GetDefaultPageData(PageReference, Int32, ILanguageSelector)

Gets a PageData object with default values. Base class implementation will create a new PageData object with properties given by page type.

Declaration
public virtual PageData GetDefaultPageData(PageReference parentPageLink, int pageTypeID, ILanguageSelector selector)
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

System.Int32 pageTypeID

The page type of the new page.

ILanguageSelector selector

The language to which page should be created.

Returns
Type Description
PageData

A PageData object that contains the default values for a new page of the indicated type that is about to be created under parentPageLink.

GetDescendents(PageReference)

Gets all the descendents for the current page (that is at all levels). The base class implementation will do recursive calls to GetChildrenReferences.

Declaration
public virtual IList<PageReference> GetDescendents(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
System.Collections.Generic.IList<PageReference>

GetLanguageBranches(PageReference)

Get all language branches for a page. The base class implemenation will first load the master page. Then look for existing languages in PageLanguages and load all languages.

Declaration
public virtual PageDataCollection GetLanguageBranches(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page to read.

Returns
Type Description
PageDataCollection

A collection of pages that contains the found language branches.

GetLocalPage(PageReference, ILanguageSelector)

Gets the page on the language as specified by the language selector.

Declaration
protected abstract PageData GetLocalPage(PageReference pageLink, ILanguageSelector languageSelector)
Parameters
Type Name Description
PageReference pageLink

The page link.

ILanguageSelector languageSelector

The language selector.

Returns
Type Description
PageData

The page on the specified language.

Remarks

The implementation should not call into SelectPageLanguage(LanguageSelectorContext) or LoadLanguage(LanguageSelectorContext) since that might cause recursive calls back to GetLocalPage. The suggested way to handle language is to call SetInitializedLanguageBranch(LanguageSelectorContext) to get the language the selector was initialized with (if any). And then return that language version or Master language if the selector was not initalized with some specific language. The following example shows the suggested way to handle language:

    LanguageSelectorContext context = new LanguageSelectorContext(pageLink);
    languageSelector.SetInitializedLanguageBranch(context);
    if (context.SelectedLanguageBranch != null)
    {
        //load language given by context.SelectedLanguage
    }
    else
    {
        //load page on masterlanguage
    }

The following code sample is an implementation of GetLocalPage() for XmlPageProvider:

GetNextAvailablePageFolderId()

Gets the next available page folder ID.

Declaration
protected virtual int GetNextAvailablePageFolderId()
Returns
Type Description
System.Int32

A folder ID or 0 if PageFolderSupportEnabled is false

Remarks

This method can be used to get a folder ID that can be assigned to property "PageFolderID". If a page has a value for PageFolderID assigned at save that value should be stored and be set each time the page is initialized, for example, by use of method SetPropertyValues.

GetPage(PageReference, ILanguageSelector)

Read a single page from the storage. The default implementation will check for the page in the cache. If it is not found there, it will call into method GetLocalPage(PageReference, ILanguageSelector).

Declaration
public PageData GetPage(PageReference pageLink, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The page to read.

ILanguageSelector selector

The language to select.

Returns
Type Description
PageData

A PageData object with the page data.

Exceptions
Type Condition
EPiServerException

Thrown if the page does not have a valid master language branch.

GetPages(PageReferenceCollection, ILanguageSelector)

The base class implementation will call GetPage(PageReference, ILanguageSelector) for each PageReference. If overriden the implementation should return all requested pages. A suggested implementation is to call SetInitializedLanguageBranch(LanguageSelectorContext) and then return pages in the language given by the passed in LanguageSelectorContext property SelectedLanguage, if the page does not exist in the specified language the page in master language branch should be returned.

Declaration
protected virtual PageDataCollection GetPages(PageReferenceCollection pageReferences, ILanguageSelector selector)
Parameters
Type Name Description
PageReferenceCollection pageReferences

The page references.

ILanguageSelector selector

A language selector.

Returns
Type Description
PageDataCollection

The pages according to the passed in references.

GetPagesBatched(IList<PageReference>, ILanguageSelector)

Gets the specified pages.

Declaration
public PageDataCollection GetPagesBatched(IList<PageReference> pageLinks, ILanguageSelector selector)
Parameters
Type Name Description
System.Collections.Generic.IList<PageReference> pageLinks

The page links.

ILanguageSelector selector

The selector.

Returns
Type Description
PageDataCollection

GetPagesWithPropertyDefinition(PropertyDefinition, Boolean, Boolean)

Gets the pages with instance of page definition.

This method is for example called to verify that no pages with page definition exist before a page definition defined in code is deleted.

Declaration
public virtual IList<ContentUsage> GetPagesWithPropertyDefinition(PropertyDefinition propertyDefinition, bool onlyNoneMasterLanguage, bool onlyPublished)
Parameters
Type Name Description
PropertyDefinition propertyDefinition

The page definition.

System.Boolean onlyNoneMasterLanguage

If set to true only non-master language is taken into account.

System.Boolean onlyPublished

If set to true only published versions are taken into account.

Returns
Type Description
System.Collections.Generic.IList<ContentUsage>
Remarks

The default implementation returns empty list.

GetParentPageReferences(PageReference)

Returns a PagePath instance containing references to all ancestors to specified page reference.

Declaration
public virtual PagePath GetParentPageReferences(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page reference to get ancestors for.

Returns
Type Description
PagePath

All ancestors to given page reference.

GetPropertyValues(PageData, PageProviderBase.PropertyTypes)

Extracts the properties (name and value) from a PageData instance. The properties returned are depending on parameter propertyTypes. It will always return all language specific properties and optionally more depending on passed in PropertyTypes. PageProviderBase.PropertyTypes is a somewhat enum which makes it possible to combine several bits to get the desired properties.

Declaration
public Dictionary<string, string> GetPropertyValues(PageData page, PageProviderBase.PropertyTypes propertyTypes)
Parameters
Type Name Description
PageData page

The page.

PageProviderBase.PropertyTypes propertyTypes

The property types.

Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.String>

GetReferencesToPageAndDescendents(PageReference, out PageReferenceCollection)

Gets the references to page and descendents. Override thsi method to get references to this page and/or its descendents, and get descendents for the page. The base class implementation will get descendents to the page(pageLink) passed in argument and then call into GetReferencesToPages(PageReferenceCollection). Make sure that your page provider implements that method properly.

Declaration
public virtual PageReferenceCollection GetReferencesToPageAndDescendents(PageReference pageLink, out PageReferenceCollection descendents)
Parameters
Type Name Description
PageReference pageLink

The page link.

PageReferenceCollection descendents

The descendents.

Returns
Type Description
PageReferenceCollection

PageReferenceCollection of all pages that hold some kind of reference to this collection of pages and descendants of the page.

GetReferencesToPages(PageReferenceCollection)

Gets the references to pages. Override this method to get all references to the given page.

Declaration
public virtual PageReferenceCollection GetReferencesToPages(PageReferenceCollection pageLinks)
Parameters
Type Name Description
PageReferenceCollection pageLinks

The page links.

Returns
Type Description
PageReferenceCollection

PageReferenceCollection of all pages that hold some kind of reference to this collection of pages.

GetUniqueUrlSegment(PageData, PageReference)

Ensures that a page has a unique URL segment (means it is unique among all its siblings on the same language).

This method will make sure that the UrlSegment is unique.

Declaration
public virtual string GetUniqueUrlSegment(PageData changedPage, PageReference destinationLink)
Parameters
Type Name Description
PageData changedPage

The changed page.

PageReference destinationLink

The destination link.

Returns
Type Description
System.String

An unique UrlSegment for all siblings in the language.

Remarks

Base class implementation will call GetChildren on destinationLink and check that no other sibling on the same language already has the same UrlSegment. If so, a unique segment is created.

HasCapability(PageProviderCapabilities)

Determines whether current provider has specified capabilities.

Declaration
public bool HasCapability(PageProviderCapabilities capabilities)
Parameters
Type Name Description
PageProviderCapabilities capabilities

The capabilities.

Returns
Type Description
System.Boolean

True if the provider has specified capabilities, otherwise false.

Initialize(String, NameValueCollection)

Initializes the provider with configuration seetings. Override this method to do any provider specific initialization.

Declaration
public override void Initialize(string name, NameValueCollection config)
Parameters
Type Name Description
System.String name

The friendly name of the provider.

System.Collections.Specialized.NameValueCollection config

A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.

Remarks

Remember to call base.Initialize in the implementation.

Exceptions
Type Condition
System.ArgumentNullException

The name of the provider is null.

System.ArgumentException

The name of the provider has a length of zero.

System.InvalidOperationException

An attempt is made to call System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection) on a provider after the provider has already been initialized.

InitializePageData(PageData, String, String, Guid, PageReference, PageReference, IList<String>)

Initializes the passed in PageData object with metaData properties and the properties specified by the pageType. It will set some default values for some metaData properties, for example, PageCreated = DateTime.Now PageChanged = DateTime.Now PageStartPublish = DateTime.Now PageWorkStatus = VersionStatus.Published PagePendingPublish = false; PageURLSegment = pageName; To set additional property values and/or change the set default values, call SetPropertyValues(PageData, Dictionary<String, String>, PageProviderBase.PropertyValidator, Boolean) with a dictionary with key propertyName and value propertyValue.

Declaration
public void InitializePageData(PageData page, string pageName, string pageTypeName, Guid pageGuid, PageReference pageLink, PageReference pageParentLink, IList<string> existingLanguages)
Parameters
Type Name Description
PageData page

The PageData object to initialize. For example, new PageData() or inherited class.

System.String pageName

Name of the page.

System.String pageTypeName

Name of the page type.

System.Guid pageGuid

The GUID-based identifier for the page.

PageReference pageLink

The page link.

PageReference pageParentLink

The page parent link.

System.Collections.Generic.IList<System.String> existingLanguages

The languages the page exist in.

InitializePageData(PageData, String, String, Guid, PageReference, PageReference, IList<String>, String)

Initializes the passed in PageData object with metaData properties and the properties specified by the pageType. It will set some default values for some metaData properties, for example, PageCreated = DateTime.Now PageChanged = DateTime.Now PageStartPublish = DateTime.Now PageWorkStatus = VersionStatus.Published PagePendingPublish = false; PageURLSegment = pageName; To set additional property values and/or change the set default values, call SetPropertyValues(PageData, Dictionary<String, String>, PageProviderBase.PropertyValidator, Boolean) with a dictionary with key propertyName and value propertyValue.

Declaration
public void InitializePageData(PageData page, string pageName, string pageTypeName, Guid pageGuid, PageReference pageLink, PageReference pageParentLink, IList<string> existingLanguages, string languageBranchId)
Parameters
Type Name Description
PageData page

The PageData object to initialize. For example, new PageData() or inherited class.

System.String pageName

Name of the page.

System.String pageTypeName

Name of the page type.

System.Guid pageGuid

The GUID-based identifier for the page.

PageReference pageLink

The page link.

PageReference pageParentLink

The page parent link.

System.Collections.Generic.IList<System.String> existingLanguages

The languages the page exist in.

System.String languageBranchId

The language branch ID.

Remarks

Any existing properties will be cleared.

ListContentOfContentType(ContentType)

Gets a list of references to pages of specified PageType.

This method is for example called to verify that no pages of a page type exist before a page type defined in code is deleted.

Declaration
public virtual IList<ContentUsage> ListContentOfContentType(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Collections.Generic.IList<ContentUsage>
Remarks

The default implementation returns empty list.

ListDelayedPublish()

Lists all pages that are set to delayed publish. Base class implementation does not support this method but returns new PageDataCollection(). If delay publishing is to be supported, this method should be overriden.

Declaration
public virtual PageDataCollection ListDelayedPublish()
Returns
Type Description
PageDataCollection

ListPublishedVersions(PageReference)

Lists the published versions. Default base class implementation has no versioning support, so it uses GetLanguageBranches(PageReference) to get pages. If versioning is to be supported, this method should be overriden.

Declaration
public virtual PageVersionCollection ListPublishedVersions(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersionCollection

All published versions for the page.

Examples

The following code sample is an implementation of ListPublishedVersions() for XmlPageProvider:

ListVersions(PageReference)

Lists all versions for a page. Default base class implementation has no versioning support so it uses GetLanguageBranches(PageReference) to get language pages. If versioning is to be supported, this method should be overriden.

Declaration
public virtual PageVersionCollection ListVersions(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersionCollection
Examples

The following code sample is an implementation of ListVersions() for XmlPageProvider:

ListVersions(PageReference, String)

Lists all versions for a page for a specific language. Default base class implementation has no versioning support, so it uses GetPage(PageReference, ILanguageSelector) to get pages. If versioning is to be supported, this method should be overriden.

Declaration
public virtual PageVersionCollection ListVersions(PageReference pageLink, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.String languageBranch

The language branch, null for master language.

Returns
Type Description
PageVersionCollection

All matching versions.

LoadCommonDraft(ContentReference, String)

Loads the common draft.

Declaration
public virtual ContentVersion LoadCommonDraft(ContentReference contentLink, string language)
Parameters
Type Name Description
ContentReference contentLink

The content link to load common draft for.

System.String language

The language.

Returns
Type Description
ContentVersion

CommonDraft if it exist, otherwise Published, If no published exist the latest saved version is returned

LoadPublishedVersion(PageReference)

Loads the published version a page on the master language branch. Default base class implementation has no versioning support, so it uses GetPage(PageReference, ILanguageSelector) to get page. If versioning is to be supported, this method should be overriden.

Declaration
public virtual PageVersion LoadPublishedVersion(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersion

PageVersion or null if page is not published.

Remarks

If the page is not published on the master language null is returned

LoadPublishedVersion(PageReference, String)

Loads the published version a page with specific language Branch. Default base class implementation has no versioning support, so it uses GetPage(PageReference, ILanguageSelector) to get page. If versioning is to be supported, this method should be overriden.

Declaration
public virtual PageVersion LoadPublishedVersion(PageReference pageLink, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.String languageBranch

The language branch.

Returns
Type Description
PageVersion

PageVersion or null if page is not published on the specified language.

Remarks

If the page is not published on the specified language null is returned

Examples

The following code sample is an implementation of LoadPublishedVersion() for XmlPageProvider:

LoadVersion(PageReference)

Loads the specified version. Default base class implementation has no versioning support, so it uses GetPage(PageReference, ILanguageSelector) to get page. If versioning is to be supported, this method should be overriden.

Declaration
public virtual PageVersion LoadVersion(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersion

Specific PageVersion.

Examples

The following code sample is an implementation of LoadVersion() for XmlPageProvider:

Move(PageReference, PageReference)

Move a page to another container within the provider instance.

Declaration
public virtual void Move(PageReference pageLink, PageReference destinationLink)
Parameters
Type Name Description
PageReference pageLink

The link to the page to move.

PageReference destinationLink

The container to which the page will be moved.

Remarks

Move between page provider instances is to be seen as a create at destination followed by a delete of source. If move is to be supported, this method needs to be overriden. A suggested implementation of move when destinationLink is WastebasketReference is to set WastebasketReference as parent and set property "PageDeleted" to true.

Examples

The following code sample is an implementation of Move() for XmlPageProvider:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Move with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Move functionality.

MoveToWastebasket(PageReference)

Moves a page to the trash can. Base class implementation calls Move(page, WastebasketReference). A suggested implementation is to set WastebasketReference as parent and set property "PageDeleted" to true.

Declaration
public virtual void MoveToWastebasket(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The link to the page to move.

Remarks

Moves a page from its current location to Trash. This is the same as doing:

Move(pageLink, WasteBasket.PageLink);

Note! You need Delete access to the page that is being moved.

ResetCounters()

Resets statistic counters.

Declaration
public void ResetCounters()

ResolveLocalPage(PageReference, out Guid)

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, ContentReference, Guid). This typically maps to PageLink, PageGuid and LinkUrl properties for a PageData instance.

Declaration
protected abstract Uri ResolveLocalPage(PageReference pageLink, out Guid guid)
Parameters
Type Name Description
PageReference pageLink

The PageReference to the page.

System.Guid guid

The GUID-based identifier for the page.

Returns
Type Description
System.Uri

the "classic" URI for the page.

Remarks

Implementations of resolving methods must not call GetPage during resolving since that can cause infinite recursion.

Examples

The following pseudo code shows how an implentation could look:

    if (noMatch)
    {
        return null;
    }
    guid = <the guid reference for the specified page>
    pageLink = <the reference with ProviderKey set as RemoteSite>
    return ConstructPageUri(pageTypeID, pageLink);

ResolveLocalPage(Guid, out 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, ContentReference, Guid). This typically maps to PageLink, PageGuid and LinkUrl properties for a PageData instance.

Declaration
protected abstract Uri ResolveLocalPage(Guid pageGuid, out PageReference pageLink)
Parameters
Type Name Description
System.Guid pageGuid

The page GUID.

PageReference pageLink

The PageReference to the page with specified GUID-based ID.

Returns
Type Description
System.Uri

The "classic" URI for the page.

Remarks

Implementations of resolving methods must not call GetPage during resolving since that can cause infinite recursion.

Examples

The following pseudo code shows how an implentation could look:

    if (noMatch)
    {
        return null;
    }
    pageLink = <the reference with ProviderKey set as RemoteSite>
    return ConstructPageUri(pageTypeID, pageLink);

ResolvePageFolder(Int32)

Resolves which pages that is associated with given pageFolderId.

Declaration
public virtual PageReference ResolvePageFolder(int pageFolderId)
Parameters
Type Name Description
System.Int32 pageFolderId

The page folder ID.

Returns
Type Description
PageReference

The page link to the page that owns specified page folder, PageReference.EmptyReference is returned if no match is found.

Remarks

If pages from page provider does not store any pages in Page Folder VPP then this can be overriden to return PageReference.EmptyReference.

Default implementation uses FindPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector) to perform resolving if provider supports Search, else PageReference.EmptyReference is returned.

Save(ContentReference, IContentSecurityDescriptor, SecuritySaveType)

Saves the specified content security descriptor.

Declaration
public virtual void Save(ContentReference contentLink, IContentSecurityDescriptor contentSecurityDescriptor, SecuritySaveType securitySaveType)
Parameters
Type Name Description
ContentReference contentLink

The content link.

IContentSecurityDescriptor contentSecurityDescriptor

The content's security descriptor.

SecuritySaveType securitySaveType

The type of security save.

Save(PageData, SaveAction)

Save page to storage with specified action. If save is to be supported, this method needs to be overriden.

Declaration
public virtual PageReference Save(PageData page, SaveAction action)
Parameters
Type Name Description
PageData page

A initalized PageData object containing data to be saved.

SaveAction action

Action that will be performed

Returns
Type Description
PageReference
Remarks

If PageLink is empty a new page will be created.

Examples

The following code sample is an implementation of Save() for XmlPageProvider:

Exceptions
Type Condition
System.NotImplementedException

Thrown if the Page Provider indicates support for Save with the Capabilities property, but does not override Move method.

System.NotSupportedException

Thrown if the Page Provider does not support Save functionality.

SetCacheSettings(PageData, CacheSettings)

Sets the cache settings for a page when it is added to cache. Override this method, for example, to set a control lifetime of PageData object in cache or to add additional cache dependency keys.

Declaration
protected virtual void SetCacheSettings(PageData page, CacheSettings cacheSettings)
Parameters
Type Name Description
PageData page

The page to set the cache settings for.

CacheSettings cacheSettings

The cache settings.

SetCacheSettings(PageReference, PageReferenceCollection, CacheSettings)

Sets the cache settings for a children listing when it is added to cache. Override this method, for example, to set control lifetime of children listing in cache or to add additional cache dependency keys.

Declaration
protected virtual void SetCacheSettings(PageReference pageLink, PageReferenceCollection childrenReferences, CacheSettings cacheSettings)
Parameters
Type Name Description
PageReference pageLink

The page link for which children references are to be added to cache.

PageReferenceCollection childrenReferences

The children references that are to be added to cache.

CacheSettings cacheSettings

The cache settings.

SetCommonDraft(ContentReference)

Sets the common draft.

Declaration
public virtual void SetCommonDraft(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

SetPageStatus(PageData, VersionStatus)

Sets the status of page, for example, Published.

Declaration
protected void SetPageStatus(PageData page, VersionStatus status)
Parameters
Type Name Description
PageData page

The page.

VersionStatus status

The status.

SetPropertyValues(PageData, Dictionary<String, String>)

Populates a PageData object with given property values.

Declaration
public void SetPropertyValues(PageData page, Dictionary<string, string> properties)
Parameters
Type Name Description
PageData page

The page to poulate.

System.Collections.Generic.Dictionary<System.String, System.String> properties

The properties to populate the page with. Should be key=property name and value=property value.

Remarks

The property values is set only if the passed in PageData has the property specified. Call, for example, InitializePageData(PageData, String, String, Guid, PageReference, PageReference, IList<String>, String) to initialize PageData object with properties.

The page will be marked as read-only, to get a writable page use overloaded method.

SetPropertyValues(PageData, Dictionary<String, String>, PageProviderBase.PropertyValidator)

Populates a PageData object with given property values.

Declaration
public void SetPropertyValues(PageData page, Dictionary<string, string> properties, PageProviderBase.PropertyValidator propertyValidator)
Parameters
Type Name Description
PageData page

The page to poulate.

System.Collections.Generic.Dictionary<System.String, System.String> properties

The properties to populate the page with. Should be key=property name and value=property value.

PageProviderBase.PropertyValidator propertyValidator

Delegate for property validation before assignment. If return true property is assigned value if returns false value is not assigned. Pass in null if no validation is required.

Remarks

The property values is set only if the passed in PageData has the property specified. Call, for example, InitializePageData(PageData, String, String, Guid, PageReference, PageReference, IList<String>, String) to initialize PageData object with properties.

The page will be marked as read-only, to get a writable page use overloaded method.

SetPropertyValues(PageData, Dictionary<String, String>, PageProviderBase.PropertyValidator, Boolean)

Populates a PageData object with given property values.

Declaration
public void SetPropertyValues(PageData page, Dictionary<string, string> properties, PageProviderBase.PropertyValidator propertyValidator, bool makeReadOnly)
Parameters
Type Name Description
PageData page

The page to poulate.

System.Collections.Generic.Dictionary<System.String, System.String> properties

The properties to populate the page with. Should be key=property name and value=property value.

PageProviderBase.PropertyValidator propertyValidator

delegate for property validation before assignment. If it returns true, property is assigned the value. If it returns false, value is not assigned. Pass in null if no validation is required.

System.Boolean makeReadOnly

If set to true the page is made read-only before returning.

Remarks

The property values is set only if the passed in PageData has the property specified. Call, for example, InitializePageData(PageData, String, String, Guid, PageReference, PageReference, IList<String>, String) to initialize PageData object with properties. PageLinkURL is ignored if present since that is created from PageLink and page type. To set LinkUrl, call property LinkURLafter call to SetProperties

Explicit Interface Implementations

IPageResolver.ResolvePage(PageReference, out Guid)

Tries to resolve a Page reference to a page.

Declaration
Uri IPageResolver.ResolvePage(PageReference pageLink, out Guid guid)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.Guid guid

The map result.

Returns
Type Description
System.Uri

A PermanentPageLinkMap if the operation was successful, null if not.

IPageResolver.ResolvePage(Guid, out PageReference)

Tries to resolve a GUID to a page.

Declaration
Uri IPageResolver.ResolvePage(Guid pageGuid, out PageReference pageLink)
Parameters
Type Name Description
System.Guid pageGuid

The page GUID.

PageReference pageLink

The resolved page link.

Returns
Type Description
System.Uri

A PermanentPageLinkMap if the operation was successful, null if not.

Implements

Extension Methods