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

Interface ITemplateRepository

Repository for template information.

Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public interface ITemplateRepository

Methods

AddModelType(Type)

Adds a model type to the repository.

Declaration
void AddModelType(Type modelType)
Parameters
Type Name Description
System.Type modelType

Type of the model.

Remarks

Adding a model type ensures that any templates marked as inherited are registered against this type when registered for an inherited model type.

AddTemplates(Type, TemplateModel[])

Adds one or many templates for the provided model type.

Declaration
void AddTemplates(Type modelType, params TemplateModel[] templates)
Parameters
Type Name Description
System.Type modelType

The primary model type that the template should be registered for.

TemplateModel[] templates

The templates that should be registered.

Remarks

Each template that is marked as inherited will not only be registered for the provided model type, but also for any other added model type added to the current repository.

List(Type)

Gets a list of all TemplateModel for a given model type.

Declaration
IEnumerable<TemplateModel> List(Type modelType)
Parameters
Type Name Description
System.Type modelType

Type of the model.

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

A list of all templates registered.

RemoveTemplate(Type, TemplateModel)

Removes a TemplateModel that has been registered for the specified model type.

Declaration
bool RemoveTemplate(Type modelType, TemplateModel template)
Parameters
Type Name Description
System.Type modelType

Type of the model.

TemplateModel template

The template model that should be removed.

Returns
Type Description
System.Boolean

true if the TemplateModel existed and was removed, if it not existed false is returned

Extension Methods