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

Class ContentLoader

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Inheritance
System.Object
ContentLoader
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.Internal
Assembly: EPiServer.dll
Version: 10.10.4
Syntax
public abstract class ContentLoader : IContentLoader

Constructors

ContentLoader()

Declaration
protected ContentLoader()

Methods

Get<T>(ContentReference)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference.

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

The link to the content.

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentLink as id.

Get<T>(ContentReference, LoaderOptions)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference given by the provided context.

Declaration
public abstract T Get<T>(ContentReference contentLink, LoaderOptions loaderOptions)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

Returns
Type Description
T

The requested content, as the specified type, in the specified language.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentLink as id.

Get<T>(ContentReference, CultureInfo)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the specific language of content item represented by the provided reference.

Declaration
public abstract T Get<T>(ContentReference contentLink, CultureInfo language)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

System.Globalization.CultureInfo language

The langauge

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Remarks

If the contentLink is a specific version (that is where WorkID is set) the language is ignored and that specific version is returned.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentLink as id.

Get<T>(Guid)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided GUID.

Declaration
public abstract T Get<T>(Guid contentGuid)
    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The content identifier.

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentGuid as id.

Get<T>(Guid, LoaderOptions)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided GUID given by the provided context.

Declaration
public abstract T Get<T>(Guid contentGuid, LoaderOptions loaderOptions)
    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The content identifier.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentGuid as id.

Get<T>(Guid, CultureInfo)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the specific language of content item represented by the provided reference.

Declaration
public abstract T Get<T>(Guid contentGuid, CultureInfo language)
    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The content identifier.

System.Globalization.CultureInfo language

The language.

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentGuid as id.

GetAncestors(ContentReference)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Retrieves all content items located above the specified content.

Declaration
public abstract IEnumerable<IContent> GetAncestors(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The reference to the item whose ancestors you want to retrieve.

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

A list of all items located above the specified reference.

GetBySegment(ContentReference, String, LoaderOptions)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the child IContentData instance that has a RouteSegment that matches urlSegment.

Declaration
public abstract IContent GetBySegment(ContentReference parentLink, string urlSegment, LoaderOptions settings)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

LoaderOptions settings

The settings to use.

Returns
Type Description
IContent

The content instance that matches urlSegment or null if no match.

Remarks

It is the passed in settings that is responsible to handle fallback and replacement settings for language.

GetBySegment(ContentReference, String, CultureInfo)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the child IContentData instance that has a RouteSegment that matches urlSegment.

Declaration
public abstract IContent GetBySegment(ContentReference parentLink, string urlSegment, CultureInfo language)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

System.Globalization.CultureInfo language

The language

Returns
Type Description
IContent

The content instance that matches urlSegment or null if no match.

Remarks

It is the passed in language that is responsible to handle fallback and replacement settings for language.

GetChildren<T>(ContentReference)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the children of the content item represented by the provided reference.

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

A reference to the parent whose children should be returned.

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

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

GetChildren<T>(ContentReference, LoaderOptions)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the children of the content item represented by the provided reference given by the provided settings.

Declaration
public abstract IEnumerable<T> GetChildren<T>(ContentReference contentLink, LoaderOptions loaderOptions)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose children should be returned.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

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

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

GetChildren<T>(ContentReference, LoaderOptions, Int32, Int32)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the children of the content item represented by the provided reference given by the provided context.

Declaration
public abstract IEnumerable<T> GetChildren<T>(ContentReference contentLink, LoaderOptions loaderOptions, int startIndex, int maxRows)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose children should be returned.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

System.Int32 startIndex

The index of the first child to return.

System.Int32 maxRows

The max number of children to return.

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

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

Remarks

This is the overload of GetChildren that supports paging.

GetChildren<T>(ContentReference, CultureInfo)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the children of the content item represented by the provided reference given the language.

Declaration
public abstract IEnumerable<T> GetChildren<T>(ContentReference contentLink, CultureInfo language)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose children should be returned.

System.Globalization.CultureInfo language

The language.

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

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

GetChildren<T>(ContentReference, CultureInfo, Int32, Int32)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the children of the content item represented by the provided reference given the language.

Declaration
public abstract IEnumerable<T> GetChildren<T>(ContentReference contentLink, CultureInfo language, int startIndex, int maxRows)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose children should be returned.

System.Globalization.CultureInfo language

The language.

System.Int32 startIndex

The index of the first child to return.

System.Int32 maxRows

The max number of children to return.

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

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

Remarks

This is the overload of GetChildren that supports paging.

GetDescendents(ContentReference)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets references to the descendents of the specified content.

Declaration
public abstract IEnumerable<ContentReference> GetDescendents(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose descendents should be returned.

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

A list of references to all the descendent of specified content.

GetItems(IEnumerable<ContentReference>, LoaderOptions)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets all content items that is represented by the provided references given by the provided context.

Declaration
public abstract IEnumerable<IContent> GetItems(IEnumerable<ContentReference> contentLinks, LoaderOptions loaderOptions)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

A list of references to content that should be fetched.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

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

A list of content for the specifed references.

Remarks

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

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

GetItems(IEnumerable<ContentReference>, CultureInfo)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets all content items that is represented by the provided references given the language.

Declaration
public abstract IEnumerable<IContent> GetItems(IEnumerable<ContentReference> contentLinks, CultureInfo language)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

A list of references to content that should be fetched.

System.Globalization.CultureInfo language

The language.

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

A list of content for the specifed references.

Remarks

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

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

TryGet<T>(ContentReference, out T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference.

Declaration
public abstract bool TryGet<T>(ContentReference contentLink, out T content)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(ContentReference, LoaderOptions, out T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference.

Declaration
public abstract bool TryGet<T>(ContentReference contentLink, LoaderOptions loaderOptions, out T content)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(ContentReference, CultureInfo, out T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference given the language.

Declaration
public abstract bool TryGet<T>(ContentReference contentLink, CultureInfo language, out T content)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

System.Globalization.CultureInfo language

The language.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

Remarks

If the contentLink is a specific version (that is where WorkID is set) the language is ignored and that specific version is returned.

TryGet<T>(Guid, out T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference.

Declaration
public abstract bool TryGet<T>(Guid contentGuid, out T content)
    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The unique identifier for the content.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(Guid, LoaderOptions, out T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference.

Declaration
public abstract bool TryGet<T>(Guid contentGuid, LoaderOptions loaderOptions, out T content)
    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The unique identifier for the content.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(Guid, CultureInfo, out T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content item represented by the provided reference given the language.

Declaration
public abstract bool TryGet<T>(Guid contentGuid, CultureInfo language, out T content)
    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The guid to the content.

System.Globalization.CultureInfo language

The language.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

Implements

Extension Methods