Try our conversational search powered by Generative AI!

Class PageProviderWrapper

Wraps a PageProviderBase in a ContentProvider. All calls to the ContentProviderBase API will be delegated to the PageProviderBase.

Inheritance
System.Object
PageProviderWrapper
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 7.19.2
Syntax
[Obsolete("The PageProvider API and the PageProviderWrapper class is obsolete. Refactor PageProviders that inherit from PageProviderBase to inherit from ContentProvider instead.")]
public class PageProviderWrapper : ContentProvider, IContentResolver, IPageCriteriaQueryService
Remarks

Use this when you have a class implementing PageProviderBase, but the API requiers a ContentProviderBase.

Constructors

PageProviderWrapper(PageProviderBase)

Initializes a new instance of the PageProviderWrapper class.

Declaration
public PageProviderWrapper(PageProviderBase provider)
Parameters
Type Name Description
PageProviderBase provider

The provider.

PageProviderWrapper(PageProviderBase, ContentFactory, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ILanguageBranchRepository, IFolderIDGenerator, LanguageSelectorFactory)

Initializes a new instance of the PageProviderWrapper class.

Declaration
[Obsolete("This constructor has been replaced, please update your dependency.")]
public PageProviderWrapper(PageProviderBase provider, ContentFactory contentFactory, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryService, TemplateResolver templateResolver, UrlSegmentHandler urlSegmentHandler, ILanguageBranchRepository languageBranchRepository, IFolderIDGenerator folderIdGenerator, LanguageSelectorFactory languageSelectorFactory)
Parameters
Type Name Description
PageProviderBase provider

The provider.

ContentFactory contentFactory

The content factory.

ServiceAccessor<IContentTypeRepository> contentTypeRepositoryService

The content type repository service.

TemplateResolver templateResolver

The template resolver.

UrlSegmentHandler urlSegmentHandler

The URL segment handler.

ILanguageBranchRepository languageBranchRepository

The language branch repository.

IFolderIDGenerator folderIdGenerator

The folder id generator.

LanguageSelectorFactory languageSelectorFactory

The language selector factory.

PageProviderWrapper(PageProviderBase, ContentFactory, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ILanguageBranchRepository, IFolderIDGenerator, LanguageSelectorFactory, IContentCopyHandler)

Initializes a new instance of the PageProviderWrapper class.

Declaration
[Obsolete("This constructor has been replaced, please update your dependency.")]
public PageProviderWrapper(PageProviderBase provider, ContentFactory contentFactory, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryService, TemplateResolver templateResolver, UrlSegmentHandler urlSegmentHandler, ILanguageBranchRepository languageBranchRepository, IFolderIDGenerator folderIdGenerator, LanguageSelectorFactory languageSelectorFactory, IContentCopyHandler contentCopyHandler)
Parameters
Type Name Description
PageProviderBase provider

The provider.

ContentFactory contentFactory

The content factory.

ServiceAccessor<IContentTypeRepository> contentTypeRepositoryService

The content type repository service.

TemplateResolver templateResolver

The template resolver.

UrlSegmentHandler urlSegmentHandler

The URL segment handler.

ILanguageBranchRepository languageBranchRepository

The language branch repository.

IFolderIDGenerator folderIdGenerator

The folder id generator.

LanguageSelectorFactory languageSelectorFactory

The language selector factory.

IContentCopyHandler contentCopyHandler

The content copy handler.

PageProviderWrapper(PageProviderBase, ContentFactory, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ILanguageBranchRepository, IFolderIDGenerator, LanguageSelectorFactory, IContentCopyHandler, IValidationService)

Initializes a new instance of the PageProviderWrapper class.

Declaration
public PageProviderWrapper(PageProviderBase provider, ContentFactory contentFactory, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryService, TemplateResolver templateResolver, UrlSegmentHandler urlSegmentHandler, ILanguageBranchRepository languageBranchRepository, IFolderIDGenerator folderIdGenerator, LanguageSelectorFactory languageSelectorFactory, IContentCopyHandler contentCopyHandler, IValidationService validationService)
Parameters
Type Name Description
PageProviderBase provider

The provider.

ContentFactory contentFactory

The content factory.

ServiceAccessor<IContentTypeRepository> contentTypeRepositoryService

The content type repository service.

TemplateResolver templateResolver

The template resolver.

UrlSegmentHandler urlSegmentHandler

The URL segment handler.

ILanguageBranchRepository languageBranchRepository

The language branch repository.

IFolderIDGenerator folderIdGenerator

The folder id generator.

LanguageSelectorFactory languageSelectorFactory

The language selector factory.

IContentCopyHandler contentCopyHandler

The content copy handler.

IValidationService validationService

The validation service dependency

Properties

Capabilities

Gets the capabilities that this content provider instance support. The base class implementation will during it's 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
[Obsolete("Use ContentProviderCapabilities ProviderCapabilities")]
public override PageProviderCapabilities Capabilities { get; }
Property Value
Type Description
PageProviderCapabilities

The capabilities.

Overrides

ContentFolderVirtualPathProvider

Gets or sets the page folder virtual path provider.

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

The page folder virtual path provider.

Overrides

Description

Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).

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

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
Overrides

PageProvider

Gets the wrapped page provider.

Declaration
public PageProviderBase PageProvider { get; }
Property Value
Type Description
PageProviderBase

The page provider.

Parameters

Gets the configuration parameters for the content provider

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

The parameters.

Overrides

ProviderCapabilities

Declaration
public override ContentProviderCapabilities ProviderCapabilities { get; }
Property Value
Type Description
ContentProviderCapabilities
Overrides

ProviderKey

Gets the provider key that this ContentProvider 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 override string ProviderKey { get; }
Property Value
Type Description
System.String

The provider key.

Overrides

SupportedVirtualPathProvider

Gets or sets the supported virtual path provider.

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

The supported virtual path provider.

Overrides

VersionRepository

Gets a repository for handling page versions.

Declaration
public override IContentVersionRepository VersionRepository { get; }
Property Value
Type Description
IContentVersionRepository
Overrides

WastebasketReference

Gets the a reference to the wastebasket for this provider.

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

Methods

AllocateUniqueContentFolderId(ContentReference, ContentReference)

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 override bool AllocateUniqueContentFolderId(ContentReference contentLink, ContentReference parentLink)
Parameters
Type Name Description
ContentReference contentLink
ContentReference parentLink

The link to the parent page.

Returns
Type Description
System.Boolean

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

Overrides
Remarks

If the page already have a page folder allocated (e.g. 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.

Copy(ContentReference, ContentReference, Boolean, AccessLevel)

Copies the specified page.

Declaration
public override ContentReference Copy(ContentReference contentLink, ContentReference destinationLink, bool publishOnDestination, AccessLevel requiredSourceAccess)
Parameters
Type Name Description
ContentReference contentLink

The page that will be copied. Must be a PageReference.

ContentReference destinationLink

The destination. Must be a PageReference.

System.Boolean publishOnDestination

if set to true new page will be set to status published.

AccessLevel requiredSourceAccess

The required source access to perform the copy operation.

Returns
Type Description
ContentReference

A reference to the new copy of the page.

Overrides

CreateLanguageBranch(ContentReference, ILanguageSelector)

Creates a language version for a page.

Declaration
public override IContent CreateLanguageBranch(ContentReference contentLink, ILanguageSelector selector)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference.

ILanguageSelector selector

The language selector.

Returns
Type Description
IContent

A new page version in the specified language.

Overrides

Delete(ContentReference, Boolean)

Deletes the specified page.

Declaration
public override void Delete(ContentReference contentLink, bool forceDelete)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference.

System.Boolean forceDelete

if set to true will delete the page even if there are other it's referenced from other content.

Overrides

DeleteChildren(ContentReference, Boolean)

Deletes the child pages of the specified page.

Declaration
public override void DeleteChildren(ContentReference contentLink, bool forceDelete)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference.

System.Boolean forceDelete

if set to true will delete the page even if there are other it's referenced from other content.

Overrides

DeleteLanguageBranch(ContentReference, String)

Deletes specified the language branch.

Declaration
public override void DeleteLanguageBranch(ContentReference contentLink, string languageBranch)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference.

System.String languageBranch

The language branch that should be deleted.

Overrides

DeleteSecurityEntity(String, SecurityEntityType)

Deletes the specified user or role name.

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

Name of the user or role.

SecurityEntityType entityUserRole

The entity user role.

Overrides

GetDefaultContent(IContent, Int32, ILanguageSelector)

Gets the default page data. Used when you want to create a new page.

Declaration
public override IContent GetDefaultContent(IContent parentContent, int contentTypeID, ILanguageSelector selector)
Parameters
Type Name Description
IContent parentContent

Content of the parent.

System.Int32 contentTypeID

The page type ID.

ILanguageSelector selector

The language selector.

Returns
Type Description
IContent

A default instance of the specified page type.

Overrides

GetDescendentReferences(ContentReference)

Gets the descendents.

Declaration
public override IList<ContentReference> GetDescendentReferences(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

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

GetLanguageBranches(ContentReference)

Gets the language branches for the specified page.

Declaration
public override IEnumerable<IContent> GetLanguageBranches(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link. Must be a PageReference.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

All language branches for this page.

Overrides

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

GetReferencesToContentItems(IEnumerable<ContentReference>)

Gets all references to the specified content iotems. Override method to get all references to the given items.

Declaration
public override IList<ReferenceInformation> GetReferencesToContentItems(IEnumerable<ContentReference> contentLinks)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

The content links to check references for.

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

A list of items that hold some kind of reference to the specified content.

Overrides

GetReferencesToLocalContent(ContentReference, Boolean)

Gets all references to the specified content. Override method to get all references to the given items and optionally references to all decendents.

Declaration
public override IList<ReferenceInformation> GetReferencesToLocalContent(ContentReference contentLink, bool includeDecendents)
Parameters
Type Name Description
ContentReference contentLink

The content links.

System.Boolean includeDecendents

if set to true references to decendents is also checked.

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

A list of items that hold some kind of reference to the specified content.

Overrides

GetSecurityDescriptor(ContentReference)

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

Declaration
public override IContentSecurityDescriptor GetSecurityDescriptor(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
IContentSecurityDescriptor
Overrides

GetUniqueUrlSegment(IContent, ContentReference)

Ensures that a content 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 override string GetUniqueUrlSegment(IContent changedContent, ContentReference destinationLink)
Parameters
Type Name Description
IContent changedContent
ContentReference destinationLink

The destination link.

Returns
Type Description
System.String

An unique urlsegment for all siblings on the language

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

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.

Overrides
Remarks

Remember to call base.Initialize in 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.

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 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
Remarks

The default implementation returns empty list.

ListDelayedPublish()

Lists all content that are set to delayed publish. Base class implementation does not support this method but returns new Enumerable.Empty<IContent>. If delay publishing is to be supported this method should be overriden.

Declaration
public override IEnumerable<IContent> ListDelayedPublish()
Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>
Overrides

LoadChildrenReferencesAndTypes(ContentReference, String, out Boolean)

Declaration
protected override IList<GetChildrenReferenceResult> LoadChildrenReferencesAndTypes(ContentReference contentLink, string languageID, out bool languageSpecific)
Parameters
Type Name Description
ContentReference contentLink
System.String languageID
System.Boolean languageSpecific
Returns
Type Description
System.Collections.Generic.IList<GetChildrenReferenceResult>
Overrides

LoadContent(ContentReference, ILanguageSelector)

This method is responsible for the actual loading of a page. Is used by the abstract base class.

Declaration
protected override IContent LoadContent(ContentReference contentLink, ILanguageSelector languageSelector)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference.

ILanguageSelector languageSelector

The language selector.

Returns
Type Description
IContent

The specified page.

Overrides

LoadContents(IList<ContentReference>, ILanguageSelector)

The implementation will call GetPagesBatched(IList<PageReference>, ILanguageSelector) on the wrapped provider.

Declaration
protected override IEnumerable<IContent> LoadContents(IList<ContentReference> contentReferences, ILanguageSelector selector)
Parameters
Type Name Description
System.Collections.Generic.IList<ContentReference> contentReferences

The content references.

ILanguageSelector selector

The selector.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>
Overrides

Move(ContentReference, ContentReference)

Moves the specified page.

Declaration
public override void Move(ContentReference contentLink, ContentReference destinationLink)
Parameters
Type Name Description
ContentReference contentLink

The page that should be moved. Must be a PageReference.

ContentReference destinationLink

The destination. Must be a PageReference.

Overrides

MoveToWastebasket(ContentReference, String)

Moves a page to the wastebasket.

Declaration
public override void MoveToWastebasket(ContentReference contentLink, string deletedBy)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference.

System.String deletedBy

The user who deleted the content.

Overrides

ResolveContent(ContentReference)

Resolves the uri to the page.

Declaration
protected override ContentResolveResult ResolveContent(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page link. Must be a PageReference

Returns
Type Description
ContentResolveResult

The uri for the resolved page.

Overrides

ResolveContent(Guid)

Resolves the uri to the page.

Declaration
protected override ContentResolveResult ResolveContent(Guid contentGuid)
Parameters
Type Name Description
System.Guid contentGuid

The page GUID.

Returns
Type Description
ContentResolveResult

The uri for the resolved page.

Overrides

ResolveContentFolder(Int32)

Resolves which content that is associated with given contentFolderId.

Declaration
public override ContentReference ResolveContentFolder(int contentFolderId)
Parameters
Type Name Description
System.Int32 contentFolderId
Returns
Type Description
ContentReference

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

Overrides
Remarks

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

Save(IContent, SaveAction)

Saves the specified page.

Declaration
public override ContentReference Save(IContent content, SaveAction action)
Parameters
Type Name Description
IContent content

The page that will be saved. Must be a PageData.

SaveAction action

The type of save that will be perfomed.

Returns
Type Description
ContentReference

A reference to the saved page, including version id.

Overrides

SaveSecurityDescriptor(ContentReference, IContentSecurityDescriptor, SecuritySaveType)

Saves the specified content security descriptor.

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

The content link.

IContentSecurityDescriptor contentSecurityDescriptor

The content security descriptor.

SecuritySaveType securitySaveType

Type of the security save.

Overrides

SetCacheSettings(ContentReference, IEnumerable<GetChildrenReferenceResult>, CacheSettings)

Sets the cache settings for children listing when it is added to cache. Override method to set e.g. control lifetime of content object in cache or to add additional cache dependency keys.

Declaration
protected override void SetCacheSettings(ContentReference contentReference, IEnumerable<GetChildrenReferenceResult> children, CacheSettings cacheSettings)
Parameters
Type Name Description
ContentReference contentReference
System.Collections.Generic.IEnumerable<GetChildrenReferenceResult> children
CacheSettings cacheSettings
Overrides

SetCacheSettings(IContent, CacheSettings)

Sets the cache settings for a content when it is added to cache. Override method to set e.g. control lifetime of content object in cache or to add additional cache dependency keys.

Declaration
protected override void SetCacheSettings(IContent content, CacheSettings cacheSettings)
Parameters
Type Name Description
IContent content

The content that is about to be added to cache.

CacheSettings cacheSettings

The cache settings.

Overrides

Explicit Interface Implementations

IPageCriteriaQueryService.FindAllPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Search for pages that fulfil specific criteria. Will not filter on access.

Declaration
PageDataCollection IPageCriteriaQueryService.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.

IPageCriteriaQueryService.FindPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Search for pages that fulfil specific criteria

Declaration
PageDataCollection IPageCriteriaQueryService.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.

Implements

Extension Methods