Interface IContentSource

Interface for providers of IContent objects.

Namespace: EPiServer.Core
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public interface IContentSource

Properties

CurrentContent

Gets the currently loaded IContent.

Declaration
IContent CurrentContent { get; }
Property Value
Type Description
IContent

Returns information about the currently loaded content, or a content in a collection when used inside a control.

Remarks

The implementation of CurrentContent is strictly up to the implementing class. Some of the templated Web controls implement IContentSource, and CurrentContent will typically refer to the current content being iterated in a collection or an array.

Another implementor is the PageBase class or one of it's subclasses like SimplePage or TemplatePage. CurrentContent in the context of PageBase refers to the currently displayed content.

CurrentContent may be null on sources that aren't connected through ContentWebForm.

Methods

Get<T>(ContentReference)

Retrieves a IContent object with information about a content, based on the ContentReference parameter.

Declaration
T Get<T>(ContentReference contentLink)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

Reference to the content being retrieved

Returns
Type Description
T

IContent object requested

Type Parameters
Name Description
T

GetChildren<T>(ContentReference)

Retrieve a IContent listing

Declaration
IEnumerable<T> GetChildren<T>(ContentReference contentLink)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

Reference to parent content

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

Returns a collection of IContent directly below the content referenced by the ContentReference parameter.

Type Parameters
Name Description
T

Extension Methods