Try our conversational search powered by Generative AI!

Class LocalPageProvider

Handles pages stored in EPiServer

Inheritance
System.Object
LocalPageProvider
Inherited Members
Namespace: EPiServer
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
[Obsolete("The page provider system is being phased out in favor of content providers")]
public class LocalPageProvider : PageProviderBase, IPageStore, IPageResolver

Constructors

LocalPageProvider()

Initializes a new instance of the LocalPageProvider class.

Declaration
public LocalPageProvider()

LocalPageProvider(IContentRepository, IPermanentLinkMapper, ServiceAccessor<IContentTypeRepository>, IContentDataFactory<PageData>, IPageDataBuilder, ILanguageBranchRepository, IContentProviderManager, TemplateResolver, ServiceAccessor<IPropertyDefinitionRepository>, ContentStore, ServiceAccessor<ContentPathDB>, ServiceAccessor<ContentSoftLinkDB>, DefaultContentVersionRepository, ServiceAccessor<IPageQuickSearch>, ServiceAccessor<SearchPages>, ServiceAccessor<IContentCoreDataLoader>, IContentCopyHandler)

Initializes a new instance of the LocalPageProvider class.

Declaration
public LocalPageProvider(IContentRepository contentRepository, IPermanentLinkMapper permanentLinkMapper, ServiceAccessor<IContentTypeRepository> contentTypeRepository, IContentDataFactory<PageData> pageDataFactory, IPageDataBuilder pageDataBuilder, ILanguageBranchRepository languageBranchRepository, IContentProviderManager pageProviderManager, TemplateResolver templateResolver, ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository, ContentStore contentStore, ServiceAccessor<ContentPathDB> pagePathDataAccess, ServiceAccessor<ContentSoftLinkDB> softLinkDataAccess, DefaultContentVersionRepository contentVersionRepository, ServiceAccessor<IPageQuickSearch> pageQuickSearcher, ServiceAccessor<SearchPages> pageSearcher, ServiceAccessor<IContentCoreDataLoader> contentCoreDataLoader, IContentCopyHandler contentCopyHandler)
Parameters
Type Name Description
IContentRepository contentRepository

The page repository.

IPermanentLinkMapper permanentLinkMapper

The permanent link mapper.

ServiceAccessor<IContentTypeRepository> contentTypeRepository

The page type repository.

IContentDataFactory<PageData> pageDataFactory

The page data factory.

IPageDataBuilder pageDataBuilder

The page data builder.

ILanguageBranchRepository languageBranchRepository

The language branch repository.

IContentProviderManager pageProviderManager

The page enterprise service.

TemplateResolver templateResolver

The template resolver.

ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository

The property definition repository.

ContentStore contentStore

The content repository.

ServiceAccessor<ContentPathDB> pagePathDataAccess

The page path data access.

ServiceAccessor<ContentSoftLinkDB> softLinkDataAccess

The soft link data access.

DefaultContentVersionRepository contentVersionRepository

The content version repository.

ServiceAccessor<IPageQuickSearch> pageQuickSearcher

The page quick search data access.

ServiceAccessor<SearchPages> pageSearcher

The search pages.

ServiceAccessor<IContentCoreDataLoader> contentCoreDataLoader

The content core data loader.

IContentCopyHandler contentCopyHandler

The content copy handler.

Methods

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

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

Declaration
public override 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

Specifies if the caller acctpts that the copy process is performed on a separate thread.

AccessLevel requiredSourceAccess

The required source access to check access against

Returns
Type Description
PageReference
Overrides
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.

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.

Delete(PageReference, Boolean)

Delete a page from database

Declaration
public override 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

Overrides
Exceptions
Type Condition
AccessDeniedException

Thrown when user doesnt have enough access right to perform this action

DeleteChildren(PageReference, Boolean)

Delete children of a page from database.

Declaration
public override 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.

Overrides
Exceptions
Type Condition
AccessDeniedException

Thrown when user does not have enough access right to perform this action

DeleteLanguageBranch(PageReference, String)

Delete a page language from database

Declaration
public override 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

Overrides
Remarks

You cannot delete the master language branch

Exceptions
Type Condition
AccessDeniedException

Thrown when user doesnt have enough access right to perform this action

DeleteVersion(PageReference)

Delete a single version of a page

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

Link to the page and version which will be deleted

Overrides
Remarks

The published version of page cannot be deleted

Exceptions
Type Condition
AccessDeniedException

Thrown when user does not have enough access right to perform this action

FindAllPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Search for pages that fulfil specific criteria. It will perfrom a database search

Declaration
public override 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.

Overrides

GetChildrenReferences(PageReference, String)

Returns references to all children of the specific page.

Declaration
protected override 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

Overrides
Remarks

Parameter languageID (if given) is used to sort on language occurance.

GetDescendents(PageReference)

Gets all the descendents for the current page (that is at all levels).

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

The page link.

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

GetLocalPage(PageReference, ILanguageSelector)

Returns the PageData object for the specified reference on the specified language

Declaration
protected override PageData GetLocalPage(PageReference pageLink, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The page link.

ILanguageSelector selector

The selector.

Returns
Type Description
PageData
Overrides

GetPages(PageReferenceCollection, ILanguageSelector)

Returns the PageData objects for the specified references on specified language (or master language if page do not exist on specified page).

Declaration
protected override 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

Overrides

GetPagesWithPropertyDefinition(PropertyDefinition, Boolean, Boolean)

Gets the pages with instance of page definition.

This method is for example called before a page definition defined in code is deleted.

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

The page definition.

System.Boolean onlyNoneMasterLanguage

if set to true only none master langauge are 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>
Overrides
Remarks

The default implementation returns empty list.

GetParentPageReferences(PageReference)

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

Declaration
public override 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

Overrides

GetReferencesToPageAndDescendents(PageReference, out PageReferenceCollection)

Gets the references to page and descendents.

Declaration
public override PageReferenceCollection GetReferencesToPageAndDescendents(PageReference pageLink, out PageReferenceCollection descendents)
Parameters
Type Name Description
PageReference pageLink
PageReferenceCollection descendents
Returns
Type Description
PageReferenceCollection
Overrides

GetReferencesToPages(PageReferenceCollection)

Gets the references to pages.

Declaration
public override 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

Overrides

ListContentOfContentType(ContentType)

Gets a list of references to pages of specified PageType.

This method is for example called before a page type defined in code is deleted.

Declaration
public override 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>
Overrides

ListDelayedPublish()

Lists all pages that are set to delayed publish.

Declaration
public override PageDataCollection ListDelayedPublish()
Returns
Type Description
PageDataCollection
Overrides

ListPublishedVersions(PageReference)

Lists the published versions for a page

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

The page link.

Returns
Type Description
PageVersionCollection

All published versions for the page

Overrides

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 override PageVersionCollection ListVersions(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersionCollection

A collection of page versions

Overrides
Examples

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

ListVersions(PageReference, String)

Lists all versions for a page with current language selection if the languageBranch is null otherwise Lists all versions for a page for a specific language

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

The page link.

System.String languageBranch

The language branch.

Returns
Type Description
PageVersionCollection

All matching versions

Overrides

LoadCommonDraft(ContentReference, String)

Loads the common draft.

Declaration
public override 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

Overrides

LoadPublishedVersion(PageReference)

Loads the published version.

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

The page link.

Returns
Type Description
PageVersion
Overrides

LoadPublishedVersion(PageReference, String)

Loads the published version a page with current language selection if the languageBranch is null otherwise Loads the published version a page for a specific language

Declaration
public override 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
Overrides

LoadVersion(PageReference)

Loads the version.

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

The page link.

Returns
Type Description
PageVersion
Overrides

Move(PageReference, PageReference)

Move a page to another container

Declaration
public override 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

Overrides
Exceptions
Type Condition
AccessDeniedException

Thrown when user does not have enough access right to perform this action.

MoveToWastebasket(PageReference)

Move a page to the Wastebasket

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

The link to the page to move

Overrides
Remarks

Moves a page from its current location into the Recycle Bin. This is the same as doing:

Move(pageLink, EPiServer.Global.EPConfig.Wastebasket, AccessLevel.Delete, AccessLevel.NoAccess);

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

Exceptions
Type Condition
AccessDeniedException

Thrown when user does not have enough access right to perform this action.

ResolveLocalPage(PageReference, out Guid)

If the passed in identifier corresponds with an identifier for a page served by local pagestore then this return true and return a PageResolveResult instance with Guid and PageReference identifiers set and the internal ("classic") link to the page. This maps to PageLink, PageGUID and LinkUrl properties for a PageData instance

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

The page link.

System.Guid guid

The guid based identifier for the page

Returns
Type Description
System.Uri

A System.Uri for the resolved page

Overrides
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 local pagestore then this return true and return a PageResolveResult instance with Guid and PageReference identifiers set and the internal ("classic") link to the page. This maps to PageLink, PageGUID and LinkUrl properties for a PageData instance.

Declaration
protected override 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

A System.Uri for the resolved page

Overrides
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 override 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.

Overrides

Save(PageData, SaveAction)

Save page to database and specify required access level manually.

Declaration
public override 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
Overrides
Remarks

If PageLink is empty a new page will be created

Exceptions
Type Condition
AccessDeniedException

Thrown when user doesnt have enough access right to perform this action

SetCommonDraft(ContentReference)

Sets the common draft.

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

The content link.

Overrides

Implements

Extension Methods