November Happy Hour will be moved to Thursday December 5th.

Class DefaultContentProvider

Handles Content which stored in EPiServer

Inheritance
System.Object
DefaultContentProvider
Implements
Inherited Members
Namespace: EPiServer
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[ServiceConfiguration]
public class DefaultContentProvider : ContentProvider, IContentResolver

Constructors

DefaultContentProvider()

Initializes a new instance of the DefaultContentProvider class.

Declaration
public DefaultContentProvider()

DefaultContentProvider(ContentStore, ContentFactory, DefaultContentVersionRepository, ILanguageBranchRepository, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ServiceAccessor<IPropertyDefinitionRepository>, ServiceAccessor<IPageQuickSearch>, IContentCopyHandler, ServiceAccessor<ContentAclDB>, IValidationService)

Initializes a new instance of the DefaultContentProvider class.

Declaration
[Obsolete("Use another constructor")]
public DefaultContentProvider(ContentStore contentStore, ContentFactory contentFactory, DefaultContentVersionRepository contentVersionRepository, ILanguageBranchRepository languageBranchRepository, ServiceAccessor<IContentTypeRepository> contentTypeRepository, TemplateResolver templateResolver, UrlSegmentHandler urlSegementHandler, ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository, ServiceAccessor<IPageQuickSearch> pageQuickSearcher, IContentCopyHandler contentCopyHandler, ServiceAccessor<ContentAclDB> contentAclDB, IValidationService validationService)
Parameters
Type Name Description
ContentStore contentStore
ContentFactory contentFactory
DefaultContentVersionRepository contentVersionRepository
ILanguageBranchRepository languageBranchRepository
ServiceAccessor<IContentTypeRepository> contentTypeRepository
TemplateResolver templateResolver
UrlSegmentHandler urlSegementHandler
ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository
ServiceAccessor<IPageQuickSearch> pageQuickSearcher
IContentCopyHandler contentCopyHandler
ServiceAccessor<ContentAclDB> contentAclDB
IValidationService validationService

DefaultContentProvider(ContentStore, ContentFactory, DefaultContentVersionRepository, ILanguageBranchRepository, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ServiceAccessor<IPropertyDefinitionRepository>, ServiceAccessor<IPageQuickSearch>, IContentCopyHandler, ServiceAccessor<ContentAclDB>, IValidationService, IContentCacheKeyCreator)

Initializes a new instance of the DefaultContentProvider class.

Declaration
[Obsolete("Use another constructor")]
public DefaultContentProvider(ContentStore contentStore, ContentFactory contentFactory, DefaultContentVersionRepository contentVersionRepository, ILanguageBranchRepository languageBranchRepository, ServiceAccessor<IContentTypeRepository> contentTypeRepository, TemplateResolver templateResolver, UrlSegmentHandler urlSegementHandler, ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository, ServiceAccessor<IPageQuickSearch> pageQuickSearcher, IContentCopyHandler contentCopyHandler, ServiceAccessor<ContentAclDB> contentAclDB, IValidationService validationService, IContentCacheKeyCreator contentCacheKeyCreator)
Parameters
Type Name Description
ContentStore contentStore
ContentFactory contentFactory
DefaultContentVersionRepository contentVersionRepository
ILanguageBranchRepository languageBranchRepository
ServiceAccessor<IContentTypeRepository> contentTypeRepository
TemplateResolver templateResolver
UrlSegmentHandler urlSegementHandler
ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository
ServiceAccessor<IPageQuickSearch> pageQuickSearcher
IContentCopyHandler contentCopyHandler
ServiceAccessor<ContentAclDB> contentAclDB
IValidationService validationService
IContentCacheKeyCreator contentCacheKeyCreator

DefaultContentProvider(ContentStore, ContentFactory, DefaultContentVersionRepository, ILanguageBranchRepository, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ServiceAccessor<IPropertyDefinitionRepository>, ServiceAccessor<IPageQuickSearch>, IContentCopyHandler, ServiceAccessor<ContentAclDB>, IValidationService, IContentCacheKeyCreator, ISynchronizedObjectInstanceCache, IPrincipalAccessor)

Initializes a new instance of the DefaultContentProvider class.

Declaration
[Obsolete("Use another constructor")]
public DefaultContentProvider(ContentStore contentStore, ContentFactory contentFactory, DefaultContentVersionRepository contentVersionRepository, ILanguageBranchRepository languageBranchRepository, ServiceAccessor<IContentTypeRepository> contentTypeRepository, TemplateResolver templateResolver, UrlSegmentHandler urlSegementHandler, ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository, ServiceAccessor<IPageQuickSearch> pageQuickSearcher, IContentCopyHandler contentCopyHandler, ServiceAccessor<ContentAclDB> contentAclDB, IValidationService validationService, IContentCacheKeyCreator contentCacheKeyCreator, ISynchronizedObjectInstanceCache cacheInstance, IPrincipalAccessor principalAccessor)
Parameters
Type Name Description
ContentStore contentStore
ContentFactory contentFactory
DefaultContentVersionRepository contentVersionRepository
ILanguageBranchRepository languageBranchRepository
ServiceAccessor<IContentTypeRepository> contentTypeRepository
TemplateResolver templateResolver
UrlSegmentHandler urlSegementHandler
ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository
ServiceAccessor<IPageQuickSearch> pageQuickSearcher
IContentCopyHandler contentCopyHandler
ServiceAccessor<ContentAclDB> contentAclDB
IValidationService validationService
IContentCacheKeyCreator contentCacheKeyCreator
ISynchronizedObjectInstanceCache cacheInstance
IPrincipalAccessor principalAccessor

DefaultContentProvider(ContentStore, DefaultContentVersionRepository, ServiceAccessor<IPropertyDefinitionRepository>, ServiceAccessor<IPageQuickSearch>, ServiceAccessor<ContentAclDB>, IPrincipalAccessor)

Initializes a new instance of the DefaultContentProvider class.

Declaration
public DefaultContentProvider(ContentStore contentStore, DefaultContentVersionRepository contentVersionRepository, ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository, ServiceAccessor<IPageQuickSearch> pageQuickSearcher, ServiceAccessor<ContentAclDB> contentAclDB, IPrincipalAccessor principalAccessor)
Parameters
Type Name Description
ContentStore contentStore
DefaultContentVersionRepository contentVersionRepository
ServiceAccessor<IPropertyDefinitionRepository> propertyDefinitionRepository
ServiceAccessor<IPageQuickSearch> pageQuickSearcher
ServiceAccessor<ContentAclDB> contentAclDB
IPrincipalAccessor principalAccessor

Properties

ContentAclDB

Gets the content acl DB.

Declaration
protected virtual ContentAclDB ContentAclDB { get; }
Property Value
Type Description
ContentAclDB

VersionRepository

Gets the version repository.

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

Methods

Delete(ContentReference, Boolean)

Delete a content from storage..

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

The content link.

System.Boolean forceDelete

if set to true [force delete].

Overrides

DeleteChildren(ContentReference, Boolean)

Deletes the children.

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

The content reference.

System.Boolean forceDelete

if set to true [force delete].

Overrides

DeleteLanguageBranch(ContentReference, String)

Deletes a language branch for the content.

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

The content link.

System.String languageBranch

The language branch.

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

GetDescendentReferences(ContentReference)

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 override IList<ContentReference> GetDescendentReferences(ContentReference pageLink)
Parameters
Type Name Description
ContentReference pageLink

The page link.

Returns
Type Description
System.Collections.Generic.IList<ContentReference>
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.

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

IsContentTypeUsed(ContentType)

Performs a check if specified ContentType is used.

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

Declaration
public override bool IsContentTypeUsed(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Boolean
Overrides
Remarks

Default implementation calls ListContentOfContentType and checks if it returns Count > 0.

IsPropertyDefinitionUsed(PropertyDefinition)

Determines whether there is data store on specified propertyDefinition.

Declaration
public override bool IsPropertyDefinitionUsed(PropertyDefinition propertyDefinition)
Parameters
Type Name Description
PropertyDefinition propertyDefinition

The property definition.

Returns
Type Description
System.Boolean

true if property definition is used; otherwise, false.

Overrides
Remarks

Default implementation calls GetPagesWithPropertyDefinition and checks if it returns Count > 0.

ListContentOfContentType(ContentType)

Gets a list of references to content of specified ContentType.

This method is for example called before a content 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 content that are set to delayed publish.

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

ListMatchingSegments(ContentReference, String)

Lists references to all children content items that have matching routing/url segments.

Declaration
protected override IList<MatchingSegmentResult> ListMatchingSegments(ContentReference parentLink, string urlSegment)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

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

LoadChildrenReferencesAndTypes(ContentReference, String, out Boolean)

Loads the children references and its type.

Declaration
protected override IList<GetChildrenReferenceResult> LoadChildrenReferencesAndTypes(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

True if the list if unique for this language, for example the sort order.

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

LoadContent(ContentReference, ILanguageSelector)

Load content for given contentlink. Load content from repository

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

The content link.

ILanguageSelector languageSelector

The language selector.

Returns
Type Description
IContent
Overrides

LoadContents(IList<ContentReference>, ILanguageSelector)

Batch loads contents

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
Remarks

Versions and published contents are splitted into two separate operations but are returned in the order as they were requested.

For references that specifies a specific version (that is where WorkID is set) the selector is ignored and the specific version is returned.

For references that is not for a specific version the content is returned in the language given by selector or master language if it does not exist in specified language.

Move(ContentReference, ContentReference)

Moves the specified content reference.

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

The content reference.

ContentReference destinationLink

The destination link.

Overrides

MoveToWastebasket(ContentReference, String)

Moves to wastebasket.

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

The content link.

System.String deletedBy

The user who deleted the content.

Overrides

ResolveContent(ContentReference)

Tries to resolve a Content from a ContentReference.

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

The content link.

Returns
Type Description
ContentResolveResult

A ContentResolveResult with the identifiers for the content or null if no content was matched.

Overrides

ResolveContent(Guid)

Tries to resolve a Content from a Guid identifier.

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

The content GUID.

Returns
Type Description
ContentResolveResult

A ContentResolveResult with the identifiers for the content or null if no content was matched.

Overrides

Save(IContent, SaveAction)

Save content to storage with specified action.

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

The content.

SaveAction action

The action.

Returns
Type Description
ContentReference
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

Implements

Extension Methods