Interface IContentLoader
Describes a service that can be used to read content data objects from a repository.
Namespace: EPiServer
Assembly: EPiServer.dll
Version: 7.19.2Syntax
public interface IContentLoader
Methods
Get<T>(ContentReference)
Gets the content item represented by the provided reference.
Declaration
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, ILanguageSelector)
Gets the content item represented by the provided reference in the language given by the provided language selector.
Declaration
T Get<T>(ContentReference contentLink, ILanguageSelector selector)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The link to the content. |
ILanguageSelector | selector | The selector that provides 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>(Guid)
Gets the content item represented by the provided GUID.
Declaration
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, ILanguageSelector)
Gets the content item represented by the provided GUID in the language given by the provided language selector.
Declaration
T Get<T>(Guid contentGuid, ILanguageSelector selector)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
System.Guid | contentGuid | The content identifier. |
ILanguageSelector | selector | The selector that provides 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 |
GetAncestors(ContentReference)
Retrieves all content items located above the specified content.
Declaration
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, ILanguageSelector)
Gets the child IContentData instance that has a RouteSegment
that matches urlSegment
.
Declaration
IContent GetBySegment(ContentReference parentLink, string urlSegment, ILanguageSelector selector)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | parentLink | The parent link. |
System.String | urlSegment | The URL segment. |
ILanguageSelector | selector | The selector. |
Returns
Type | Description |
---|---|
IContent | The content instance that matches |
Remarks
It is the passed in selector
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
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, ILanguageSelector)
Gets the children of the content item represented by the provided reference in the language given by the provided language selector.
Declaration
IEnumerable<T> GetChildren<T>(ContentReference contentLink, ILanguageSelector selector)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | A reference to the parent whose children should be returned. |
ILanguageSelector | selector | The selector that provides 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, ILanguageSelector, Int32, Int32)
Gets the children of the content item represented by the provided reference in the language given by the provided language selector.
Declaration
IEnumerable<T> GetChildren<T>(ContentReference contentLink, ILanguageSelector selector, int startIndex, int maxRows)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | A reference to the parent whose children should be returned. |
ILanguageSelector | selector | The selector that provides 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.
GetDescendents(ContentReference)
Gets references to the descendents of the specified content.
Declaration
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>, ILanguageSelector)
Gets all content items that is represented by the provided references in the language given by the provided language selector.
Declaration
IEnumerable<IContent> GetItems(IEnumerable<ContentReference> contentLinks, ILanguageSelector selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ContentReference> | contentLinks | 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.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
selector
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
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, ILanguageSelector, out T)
Gets the content item represented by the provided reference.
Declaration
bool TryGet<T>(ContentReference contentLink, ILanguageSelector languageSelector, out T content)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The link to the content. |
ILanguageSelector | languageSelector | The selector that provides 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. |