Class ContentProvider

The base class for Content Provider.

Inheritance
System.Object
ContentProvider
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public abstract class ContentProvider : IContentBatchResolver, IContentResolver
Remarks

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

Constructors

ContentProvider()

Initializes a new instance of the ContentProvider class.

Declaration
public ContentProvider()

Fields

DefaultProviderKey

Name of the default provider when defined in configuration.

Declaration
public const string DefaultProviderKey = "default"
Field Value
Type Description
System.String

Properties

CacheInstance

Declaration
[Obsolete("Add a constructor argument for any dependencies that you require in your ContentProvider.")]
protected ISynchronizedObjectInstanceCache CacheInstance { get; }
Property Value
Type Description
ISynchronizedObjectInstanceCache

ContentCoreDataLoader

Gets or sets the content core data loader.

Declaration
[Obsolete("Add a constructor argument for any dependencies that you require in your ContentProvider.")]
protected Injected<IContentCoreDataLoader> ContentCoreDataLoader { get; set; }
Property Value
Type Description
Injected<IContentCoreDataLoader>

ContentFactory

Gets the content factory.

Declaration
[Obsolete("Add a constructor argument for any dependencies that you require in your ContentProvider.")]
protected IContentFactory ContentFactory { get; }
Property Value
Type Description
IContentFactory

ContentTypeRepository

Gets the content type repository.

Declaration
[Obsolete("Add a constructor argument for any dependencies that you require in your ContentProvider.")]
protected IContentTypeRepository ContentTypeRepository { get; }
Property Value
Type Description
IContentTypeRepository

DependencyHelper

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Get or sets a ContentProviderDependencyHelper instance that provides the abstract class with dependencies.

Declaration
public ContentProviderDependencyHelper DependencyHelper { get; set; }
Property Value
Type Description
ContentProviderDependencyHelper
Remarks

This property is only provided for unit testing purposes.

EntryPoint

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

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

The entry point.

Remarks

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

FolderIDGenerator

Declaration
[Obsolete("Virtual Path Providers are no longer supported, remove usage of this API")]
protected IFolderIDGenerator FolderIDGenerator { get; }
Property Value
Type Description
IFolderIDGenerator

IconPath

Gets the icon path defined for the 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 provider instance. The value is given by specifying 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 ILanguageBranchRepository

Declaration
[Obsolete("Add a constructor argument for any dependencies that you require in your ContentProvider.")]
protected ILanguageBranchRepository LanguageBranchRepository { get; }
Property Value
Type Description
ILanguageBranchRepository

ListingFetchCacheHits

Counts calls into the ContentProviders 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 contents

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

ListingFetchDatabaseReads

Counts calls into the ContentProvider 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 virtual string Name { get; }
Property Value
Type Description
System.String

PageFetchCacheHits

Counts calls into the ContentProviders cache for the Content fetchings

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

PageFetchCount

Counts the total fetching into the database and cache for contents

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

PageFetchDatabaseReads

Counts calls into the ContentProvider for content fetchings

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

Parameters

Gets the configuration parameters for the content provider

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

The parameters.

ProviderCacheKey

Gets the provider cache key.

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

ProviderCapabilities

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 ContentProviderCapabilities) and set the capabilities for the provider instance according to the passed in configuration values.

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

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 virtual string ProviderKey { get; }
Property Value
Type Description
System.String

The provider key.

StatisticsCollectedSince

Returns the statistics last start datetime

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

ValidationService

Declaration
[Obsolete("Add a constructor argument for any dependencies that you require in your ContentProvider.")]
protected IValidationService ValidationService { get; }
Property Value
Type Description
IValidationService

VersionRepository

Gets the version repository.

Declaration
public virtual IContentVersionRepository VersionRepository { get; }
Property Value
Type Description
IContentVersionRepository
Remarks

Default implementation does not support versioning and has repository implemented by NullContentVersionRepository

WastebasketName

Gets the name of the wastebasket.

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

The name of the wastebasket.

WastebasketReference

Gets the wastebasket reference.

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

Methods

AddChildrenListingToCache(ContentReference, IList<ContentReference>, String, String[])

Adds the children listing to cache.

Declaration
[Obsolete("Use AddChildrenListingToCache(ContentReference contentReference, IList<GetChildrenReferenceResult> children, string cacheKey, params string[] dependencyCacheKeys)", false)]
protected void AddChildrenListingToCache(ContentReference contentReference, IList<ContentReference> children, string cacheKey, params string[] dependencyCacheKeys)
Parameters
Type Name Description
ContentReference contentReference

The content reference.

System.Collections.Generic.IList<ContentReference> children

The children.

System.String cacheKey

The cache key.

System.String[] dependencyCacheKeys

The dependency cache keys.

AddChildrenListingToCache(ContentReference, IList<GetChildrenReferenceResult>, String, String[])

Adds the children listing to cache.

Declaration
protected void AddChildrenListingToCache(ContentReference contentReference, IList<GetChildrenReferenceResult> children, string cacheKey, params string[] dependencyCacheKeys)
Parameters
Type Name Description
ContentReference contentReference
System.Collections.Generic.IList<GetChildrenReferenceResult> children
System.String cacheKey
System.String[] dependencyCacheKeys

AddContentToCache(IContent, IEnumerable<String>)

Adds the content to cache.

Declaration
protected void AddContentToCache(IContent content, IEnumerable<string> extraCacheDependencies = null)
Parameters
Type Name Description
IContent content

The content.

System.Collections.Generic.IEnumerable<System.String> extraCacheDependencies

Optional extra cache keys to tie the cached object to.

AddSegmentListingToCache(ContentReference, String, IList<MatchingSegmentResult>, String, String[])

Adds the matched listing to cache.

Declaration
protected void AddSegmentListingToCache(ContentReference parentLink, string urlSegment, IList<MatchingSegmentResult> matches, string cacheKey, params string[] dependencyCacheKeys)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

System.Collections.Generic.IList<MatchingSegmentResult> matches

The matches.

System.String cacheKey

The cache key.

System.String[] dependencyCacheKeys

The dependency cache keys.

AllocateUniqueContentFolderId(ContentReference, ContentReference)

Declaration
[Obsolete("Virtual Path Providers are no longer supported, remove usage of this API")]
public virtual bool AllocateUniqueContentFolderId(ContentReference contentLink, ContentReference parentLink)
Parameters
Type Name Description
ContentReference contentLink
ContentReference parentLink
Returns
Type Description
System.Boolean

ClearProviderPagesFromCache()

Remove all conteent served from this provider from the cache

Declaration
public void ClearProviderPagesFromCache()

ConstructContentUri(Int32, ContentReference, Guid)

Creates an URI given content type, ContentLink, ContentGuid

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

The content type id.

ContentReference contentLink

The content link.

System.Guid contentGuid

The content GUID.

Returns
Type Description
System.Uri

Copy(ContentReference, ContentReference, Boolean, AccessLevel)

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

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

The content link.

ContentReference destinationLink

The destination link.

System.Boolean publishOnDestination

if set to true [publish on destination].

AccessLevel requiredSourceAccess

The required source access.

Returns
Type Description
ContentReference

CreateCachePolicyFromCacheSettings(CacheSettings, IEnumerable<String>, String[])

Declaration
protected CacheEvictionPolicy CreateCachePolicyFromCacheSettings(CacheSettings settings, IEnumerable<string> additionalCacheDependencies, params string[] additionalMasterKeys)
Parameters
Type Name Description
CacheSettings settings
System.Collections.Generic.IEnumerable<System.String> additionalCacheDependencies
System.String[] additionalMasterKeys
Returns
Type Description
CacheEvictionPolicy

CreateContentResolveResult(ContentCoreData)

Creates the content resolve result.

Declaration
protected virtual ContentResolveResult CreateContentResolveResult(ContentCoreData contentData)
Parameters
Type Name Description
ContentCoreData contentData

The content data.

Returns
Type Description
ContentResolveResult

CreateLanguageBranch(ContentReference, ILanguageSelector)

Creates the language branch.

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

The content link.

ILanguageSelector selector

The selector.

Returns
Type Description
IContent

Delete(ContentReference, Boolean)

Delete a content from storage..

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

The content link.

System.Boolean forceDelete

if set to true [force delete].

DeleteChildren(ContentReference, Boolean)

Deletes the children. If delete is to be supported this method needs to be overriden.

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

The content link.

System.Boolean forceDelete

if set to true [force delete].

DeleteLanguageBranch(ContentReference, String)

Deletes a language branch for the content.

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

The content link.

System.String languageBranch

The language branch.

DeleteSecurityEntity(String, SecurityEntityType)

Deletes the specified user or role name.

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

GetChildrenReferences<T>(ContentReference, String, Int32, Int32)

Gets the children references.

Declaration
public IList<GetChildrenReferenceResult> GetChildrenReferences<T>(ContentReference contentReference, string languageID, int startIndex, int maxRows)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentReference
System.String languageID
System.Int32 startIndex
System.Int32 maxRows
Returns
Type Description
System.Collections.Generic.IList<GetChildrenReferenceResult>
Type Parameters
Name Description
T
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.

GetDefaultContent(IContent, Int32, ILanguageSelector)

Gets the default content.

Declaration
public virtual IContent GetDefaultContent(IContent parentContent, int contentTypeID, ILanguageSelector languageSelector)
Parameters
Type Name Description
IContent parentContent

Content of the parent.

System.Int32 contentTypeID

The content type ID.

ILanguageSelector languageSelector

The language selector.

Returns
Type Description
IContent

GetDescendentReferences(ContentReference)

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

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

The content link.

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

GetLanguageBranches(ContentReference)

Gets the language branches.

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

The content link.

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

GetMatchingSegments(ContentReference, String)

Gets all matching segments that has a RouteSegment that matches urlSegment.

Declaration
public IList<MatchingSegmentResult> GetMatchingSegments(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>

A list of all matching content instances.

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

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

GetScatteredContents(IEnumerable<ContentReference>, ILanguageSelector)

Gets the IContent instances given passed in contentLinks.

Declaration
public IList<IContent> GetScatteredContents(IEnumerable<ContentReference> contentLinks, ILanguageSelector selector)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

The content links.

ILanguageSelector selector

The selector.

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

In contentLinks contain duplicate entries only one IContent instance is returned for the duplicate entries.

If there is no IContent that matches an entry in contentLinks that entry is ignored.

GetSecurityDescriptor(ContentReference)

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

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

The content link.

Returns
Type Description
IContentSecurityDescriptor

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 virtual string GetUniqueUrlSegment(IContent changedContent, ContentReference destinationLink)
Parameters
Type Name Description
IContent changedContent

The changed content.

ContentReference destinationLink

The destination link.

Returns
Type Description
System.String

An unique urlsegment for all siblings on 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.

GetWasteBasket()

Gets the waste basket.

Declaration
protected virtual IContent GetWasteBasket()
Returns
Type Description
IContent

The waste basket.

HasCapability(ContentProviderCapabilities)

Determines whether the specified provider capabilities has capability.

Declaration
public bool HasCapability(ContentProviderCapabilities contentProviderCapabilities)
Parameters
Type Name Description
ContentProviderCapabilities contentProviderCapabilities

The provider capabilities.

Returns
Type Description
System.Boolean

true if the specified provider capabilities has capability; otherwise, false.

Initialize(String, NameValueCollection)

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

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

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 virtual bool IsContentTypeUsed(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Boolean
Remarks

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

IsPropertyDefinitionUsed(PropertyDefinition)

Determines whether [is property definition used] [the specified property definition].

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

Remarks

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

ListContentOfContentType(ContentType)

Gets a list of references to pages of specified PageType.

This method is for example called to verify that no content of a type exist before a content 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 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 virtual IEnumerable<IContent> ListDelayedPublish()
Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

ListMatchingSegments(ContentReference, String)

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

Declaration
protected virtual 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>
Remarks

Default implementation will use LoadChildren<T>(ContentReference, ILanguageSelector, Int32, Int32) and GetLanguageBranches(ContentReference) to find all matching segments.

Load(ContentReference, ILanguageSelector)

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

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

The content link.

ILanguageSelector selector

The selector.

Returns
Type Description
IContent

LoadBatched(IList<ContentReference>, ILanguageSelector)

Gets all content items that is represented by the provided references in the language given by the provided language selector.

Declaration
public IList<IContent> LoadBatched(IList<ContentReference> contentReferences, ILanguageSelector selector)
Parameters
Type Name Description
System.Collections.Generic.IList<ContentReference> contentReferences

A list of references to content that should be fetched.

ILanguageSelector selector

The selector that provides the language to get the content in.

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

A list of content for the specifed references.

Remarks

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

If contentReferences contain duplicate entries only one IContent instance is returned for the duplicate entries.

LoadChildren<T>(ContentReference, ILanguageSelector, Int32, Int32)

Retrieves the children for a specific content. The base class implementation will check for the list of references and content types in the cache. If not found it will call GetChildrenReferences<T>(ContentReference, String, Int32, Int32). It will then try to load the contents from cache. For those contents not found in cache it will call LoadContents(IList<ContentReference>, ILanguageSelector).

Declaration
public IEnumerable<T> LoadChildren<T>(ContentReference contentLink, ILanguageSelector selector, int startIndex, int maxRows)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink
ILanguageSelector selector
System.Int32 startIndex
System.Int32 maxRows
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

LoadChildrenReferencesAndTypes(ContentReference, String, out Boolean)

Loads the children references and types

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

LoadContent(ContentReference, ILanguageSelector)

Load content for given contentlink.

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

The content link.

ILanguageSelector languageSelector

The language selector.

Returns
Type Description
IContent

A language specific content or master language version content

Remarks

If the requested content does not exist for the languageSelector then the content of master language version should be retuned.

LoadContents(IList<ContentReference>, ILanguageSelector)

The base class implementation will call Load(ContentReference, ILanguageSelector) for each ContentReference. If overriden the implementation should return all requested contents.

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

The loaded list of content items (method should never return null)

Remarks

A suggested implementation is to:

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

For references that is not for a specific version call return contents in the language given by Language property. If System.Globalization.CultureInfo.InvariantCulture or null is passed in or if the content does not exist in the specified language then content in master language branch should be returned.

Move(ContentReference, ContentReference)

Move a content to another container within the provider instance.

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

The content link.

ContentReference destinationLink

The destination link.

MoveToWastebasket(ContentReference, String)

Moves to wastebasket.

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

The content link.

System.String deletedBy

The user who deleted the content.

ResetCounters()

Reset statistic counters

Declaration
public void ResetCounters()

ResolveContent(ContentReference)

Tries to resolve a Content from a ContentReference.

Declaration
protected virtual 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.

Remarks

This method should be implemented to support permanent link support. With permanent link means that a link to a IContent instance can be stored in a Guid based format. Then the link is not broken even if content instance moves. Also permanent links are preserved during import/export and mirroring.

ResolveContent(IEnumerable<ContentReference>)

Tries to resolve Contents from a list of ContentReference.

Declaration
protected virtual IEnumerable<ContentResolveResult> ResolveContent(IEnumerable<ContentReference> contentLinks)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

The content links.

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

A list of matched ContentResolveResult.

ResolveContent(IEnumerable<Guid>)

Tries to resolve Contents from a list of Guid identifiers.

Declaration
protected virtual IEnumerable<ContentResolveResult> ResolveContent(IEnumerable<Guid> contentGuids)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Guid> contentGuids

The content GUIDs.

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

A list of matched ContentResolveResult.

ResolveContent(Guid)

Tries to resolve a Content from a Guid identifier.

Declaration
protected virtual 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.

Remarks

This method should be implemented to support permanent link support. With permanent link means that a link to a IContent instance can be stored in a Guid based format. Then the link is not broken even if content instance moves. Also permanent links are preserved during import/export and mirroring.

ResolveContentFolder(Int32)

Declaration
[Obsolete("Virtual Path Providers are no longer supported, remove usage of this API")]
public virtual ContentReference ResolveContentFolder(int contentFolderId)
Parameters
Type Name Description
System.Int32 contentFolderId
Returns
Type Description
ContentReference

Save(IContent, SaveAction)

Save content to storage with specified action.

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

The content.

SaveAction action

The action.

Returns
Type Description
ContentReference

SaveSecurityDescriptor(ContentReference, IContentSecurityDescriptor, SecuritySaveType)

Saves the specified content security descriptor.

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

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 virtual void SetCacheSettings(ContentReference contentReference, IEnumerable<GetChildrenReferenceResult> children, CacheSettings cacheSettings)
Parameters
Type Name Description
ContentReference contentReference
System.Collections.Generic.IEnumerable<GetChildrenReferenceResult> children
CacheSettings cacheSettings

SetCacheSettings(ContentReference, String, IEnumerable<MatchingSegmentResult>, CacheSettings)

Sets the cache settings for matched children url segments 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 virtual void SetCacheSettings(ContentReference parentLink, string urlSegment, IEnumerable<MatchingSegmentResult> childrenMatches, CacheSettings cacheSettings)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

System.Collections.Generic.IEnumerable<MatchingSegmentResult> childrenMatches

The children matches.

CacheSettings cacheSettings

The cache settings.

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

ThrowValidationException(ICollection<ValidationError>)

Throws a System.ComponentModel.DataAnnotations.ValidationException populated with the provided validation errors if there are any severe enough.

Declaration
protected virtual void ThrowValidationException(ICollection<ValidationError> errors)
Parameters
Type Name Description
System.Collections.Generic.ICollection<ValidationError> errors

Collection of errors found.

Exceptions
Type Condition
System.ComponentModel.DataAnnotations.ValidationException

Thrown if the validation find any issues with the content.

Validate(IContent, SaveAction)

Validates a content item before it is to be saved.

Declaration
[Obsolete("Use overload that takes ContentSaveValidationContext")]
public virtual void Validate(IContent content, SaveAction action)
Parameters
Type Name Description
IContent content

The content item about to be saved.

SaveAction action

The type of save action that is being requested.

Exceptions
Type Condition
System.ComponentModel.DataAnnotations.ValidationException

Thrown if the validation find any issues with the content.

Validate(IContent, ContentSaveValidationContext)

Validates a content item before it is to be saved.

Declaration
public virtual void Validate(IContent content, ContentSaveValidationContext saveValidationContext)
Parameters
Type Name Description
IContent content

The content item about to be saved.

ContentSaveValidationContext saveValidationContext

The context for the validation..

Exceptions
Type Condition
System.ComponentModel.DataAnnotations.ValidationException

Thrown if the validation find any issues with the content.

ValidateForPublishing(IContent)

Validates the content before its about to be published.

Declaration
protected virtual IEnumerable<ValidationError> ValidateForPublishing(IContent content)
Parameters
Type Name Description
IContent content

The content item that is to be published

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

A list of all errors that are found

Remarks

The default implementation ensures in the case of a local content that there is a published version of the master language before publishing the local language.

Explicit Interface Implementations

IContentResolver.ResolveContent(ContentReference)

Tries to resolve a Content from a ContentReference.

Declaration
ContentResolveResult IContentResolver.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.

IContentResolver.ResolveContent(Guid)

Tries to resolve a Content from a Guid identifier.

Declaration
ContentResolveResult IContentResolver.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.

Implements

Extension Methods