Try our conversational search powered by Generative AI!

Class TemplateResolverExtensions

Extends ITemplateResolver with convinent methods.

Inheritance
System.Object
TemplateResolverExtensions
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.Web
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public static class TemplateResolverExtensions

Methods

HasTemplate(ITemplateResolver, Object, TemplateTypeCategories)

Determines whether the provided item has a template matching the provided template category.

Declaration
public static bool HasTemplate(this ITemplateResolver templateResolver, object item, TemplateTypeCategories category)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Object item

The item to check template for.

TemplateTypeCategories category

The category of template type that should be checked for.

Returns
Type Description
System.Boolean

true if the specified item has a matching template; otherwise, false.

HasTemplate(ITemplateResolver, Object, TemplateTypeCategories, IEnumerable<String>)

Determines whether the provided item has a template matching the provided template category.

Declaration
public static bool HasTemplate(this ITemplateResolver templateResolver, object item, TemplateTypeCategories category, IEnumerable<string> templateTags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Object item

The item to check template for.

TemplateTypeCategories category

The category of template type that should be checked for.

System.Collections.Generic.IEnumerable<System.String> templateTags

The tags to use when selecting template.

Returns
Type Description
System.Boolean

true if the specified item has a matching template; otherwise, false.

HasTemplate(ITemplateResolver, Object, TemplateTypeCategories, String)

Determines whether the provided item has a template matching the provided template category.

Declaration
public static bool HasTemplate(this ITemplateResolver templateResolver, object item, TemplateTypeCategories category, string templateTag)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Object item

The item to check template for.

TemplateTypeCategories category

The category of template type that should be checked for.

System.String templateTag

The tags to use when selecting template.

Returns
Type Description
System.Boolean

true if the specified item has a matching template; otherwise, false.

HasTemplate(ITemplateResolver, Type, TemplateTypeCategories, IEnumerable<String>)

Determines whether the provided type has a template matching the provided template category.

Declaration
public static bool HasTemplate(this ITemplateResolver templateResolver, Type itemType, TemplateTypeCategories category, IEnumerable<string> templateTags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Type itemType

The type to check template for.

TemplateTypeCategories category

The category of template type that should be checked for.

System.Collections.Generic.IEnumerable<System.String> templateTags

The tags to use when selecting template.

Returns
Type Description
System.Boolean

true if the specified type has a matching template; otherwise, false.

Resolve(ITemplateResolver, Object, TemplateTypeCategories, IEnumerable<String>)

Resolves what rendering template that should be used for the provided item given that it is of the provided template category.

Declaration
public static TemplateModel Resolve(this ITemplateResolver templateResolver, object item, TemplateTypeCategories category, IEnumerable<string> templateTags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Object item

The item of which type the template should be associated with.

TemplateTypeCategories category

The category of template type that should be returned.

System.Collections.Generic.IEnumerable<System.String> templateTags

The tags to use when selecting template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Remarks

The tags are treated as a prioritized list meaning a template with a tag matching a preceding tag will be preffered.

Resolve(ITemplateResolver, Object, TemplateTypeCategories, String)

Resolves what rendering template that should be used for the provided item given that it is of the provided template category.

Declaration
public static TemplateModel Resolve(this ITemplateResolver templateResolver, object item, TemplateTypeCategories category, string templateTag)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Object item

The item of which type the template should be associated with.

TemplateTypeCategories category

The category of template type that should be returned.

System.String templateTag

The tag to use when selecting template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Resolve(ITemplateResolver, Type, TemplateTypeCategories, IEnumerable<String>)

Resolves what rendering template that should be used for the provided type given that it is of the provided template category.

Declaration
public static TemplateModel Resolve(this ITemplateResolver templateResolver, Type itemType, TemplateTypeCategories category, IEnumerable<string> templateTags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Type itemType

The type of which type the template should be associated with.

TemplateTypeCategories category

The category of template type that should be returned.

System.Collections.Generic.IEnumerable<System.String> templateTags

The tags to use when selecting template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Remarks

The tags are treated as a prioritized list meaning a template with a tag matching a preceding tag will be preffered.

Resolve(ITemplateResolver, Type, TemplateTypeCategories, String)

Resolves what rendering template that should be used for the provided type given that it is of the provided template category.

Declaration
public static TemplateModel Resolve(this ITemplateResolver templateResolver, Type itemType, TemplateTypeCategories category, string templateTag)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

System.Type itemType

The type of which type the template should be associated with.

TemplateTypeCategories category

The category of template type that should be returned.

System.String templateTag

The tag to use when selecting template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Resolve<TItem>(ITemplateResolver, TemplateTypeCategories, IEnumerable<String>)

Resolves what rendering template that should be used for the provided type given that it is of the provided template category.

Declaration
public static TemplateModel Resolve<TItem>(this ITemplateResolver templateResolver, TemplateTypeCategories category, IEnumerable<string> templateTags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

TemplateTypeCategories category

The category of template type that should be returned.

System.Collections.Generic.IEnumerable<System.String> templateTags

The tags to use when selecting template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Type Parameters
Name Description
TItem

The type of which type the template should be associated with.

Remarks

The tags are treated as a prioritized list meaning a template with a tag matching a preceding tag will be preffered.

Resolve<TItem>(ITemplateResolver, TemplateTypeCategories, String)

Resolves what rendering template that should be used for the provided type given that it is of the provided template category.

Declaration
public static TemplateModel Resolve<TItem>(this ITemplateResolver templateResolver, TemplateTypeCategories category, string templateTag)
Parameters
Type Name Description
ITemplateResolver templateResolver

The resolver that is being extended

TemplateTypeCategories category

The category of template type that should be returned.

System.String templateTag

The tag to use when selecting template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Type Parameters
Name Description
TItem

The type of which type the template should be associated with.