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 |
---|---|---|
Content |
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 |
---|---|
Type |
Is thrown if actual type is not assignable to T. |
Content |
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 |
---|---|---|
Content |
contentLink | The link to the content. |
Loader |
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 |
---|---|
Type |
Is thrown if actual type is not assignable to T. |
Content |
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 |
---|---|---|
Content |
contentLink | The link to the content. |
System. |
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 Worklanguage
is ignored and that specific version is returned.
Exceptions
Type | Condition |
---|---|
Type |
Is thrown if actual type is not assignable to T. |
Content |
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. |
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 |
---|---|
Type |
Is thrown if actual type is not assignable to T. |
Content |
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. |
contentGuid | The content identifier. |
Loader |
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 |
---|---|
Type |
Is thrown if actual type is not assignable to T. |
Content |
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. |
contentGuid | The content identifier. |
System. |
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 |
---|---|
Type |
Is thrown if actual type is not assignable to T. |
Content |
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 |
---|---|---|
Content |
contentLink | The reference to the item whose ancestors you want to retrieve. |
Returns
Type | Description |
---|---|
System. |
A list of all items located above the specified reference. |
GetBySegment(ContentReference, String, LoaderOptions)
Gets the child IContenturlSegment
.
Declaration
public abstract IContent GetBySegment(ContentReference parentLink, string urlSegment, LoaderOptions settings)
Parameters
Type | Name | Description |
---|---|---|
Content |
parentLink | The parent link. |
System. |
urlSegment | The URL segment. |
Loader |
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 IContenturlSegment
.
Declaration
public abstract IContent GetBySegment(ContentReference parentLink, string urlSegment, CultureInfo language)
Parameters
Type | Name | Description |
---|---|---|
Content |
parentLink | The parent link. |
System. |
urlSegment | The URL segment. |
System. |
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 |
---|---|---|
Content |
contentLink | A reference to the parent whose children should be returned. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Content |
contentLink | A reference to the parent whose children should be returned. |
Loader |
loaderOptions | The settings that specifies how the content should be loaded, e.g. the language to get the content in. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Content |
contentLink | A reference to the parent whose children should be returned. |
Loader |
loaderOptions | The settings that specifies how the content should be loaded, e.g. the language to get the content in. |
System. |
startIndex | The index of the first child to return. |
System. |
maxRows | The max number of children to return. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Content |
contentLink | A reference to the parent whose children should be returned. |
System. |
language | The language. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Content |
contentLink | A reference to the parent whose children should be returned. |
System. |
language | The language. |
System. |
startIndex | The index of the first child to return. |
System. |
maxRows | The max number of children to return. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Content |
contentLink | A reference to the parent whose descendents should be returned. |
Returns
Type | Description |
---|---|
System. |
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. |
contentLinks | A list of references to content that should be fetched. |
Loader |
loaderOptions | The settings that specifies how the content should be loaded, e.g. the language to get the content in. |
Returns
Type | Description |
---|---|
System. |
A list of content for the specifed references. |
Remarks
For references that specifies a specific version (that is where Work
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. |
contentLinks | A list of references to content that should be fetched. |
System. |
language | The language. |
Returns
Type | Description |
---|---|
System. |
A list of content for the specifed references. |
Remarks
For references that specifies a specific version (that is where Worklanguage
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 |
---|---|---|
Content |
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. |
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 |
---|---|---|
Content |
contentLink | The link to the content. |
Loader |
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. |
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 |
---|---|---|
Content |
contentLink | The link to the content. |
System. |
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. |
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 Worklanguage
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. |
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. |
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. |
contentGuid | The unique identifier for the content. |
Loader |
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. |
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. |
contentGuid | The guid to the content. |
System. |
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. |
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. |