Class ContentLoader
Inheritance
Implements
Namespace: EPiServer.Core.Internal
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public abstract class ContentLoader : Object, IContentLoader
Constructors
ContentLoader()
Declaration
protected ContentLoader()
Methods
Get<T>(ContentReference)
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 |
Get<T>(ContentReference, LoaderOptions)
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 |
Get<T>(ContentReference, CultureInfo)
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 |
Get<T>(Guid)
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 |
Get<T>(Guid, LoaderOptions)
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 |
Get<T>(Guid, CultureInfo)
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 |
GetAncestors(ContentReference)
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)
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 |
Remarks
It is the passed in settings
that is responsible to handle fallback and replacement settings for language.
GetBySegment(ContentReference, String, CultureInfo)
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 |
Remarks
It is the passed in language
that is responsible to handle fallback and replacement settings for language.
GetChildren<T>(ContentReference)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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. |