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

Class TemplateResolverExtensions

Extends ITemplateResolver with convinent methods.

Inheritance
System.Object
TemplateResolverExtensions
Namespace: EPiServer.Web
Assembly: EPiServer.Cms.AspNetCore.Templating.dll
Version: 12.0.3
Syntax
public static class TemplateResolverExtensions : Object

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, Object, Type, 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, Type itemType, TemplateTypeCategories category, IEnumerable<string> tags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The template resolver being extended

System.Object item

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

System.Type itemType

in case item is null then type is used for resolving

TemplateTypeCategories category

The category of template type that should be returned.

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

The tags to use when selecting a template.

Returns
Type Description
TemplateModel

A TemplateModel object that contains information on the template.

Remarks

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

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.

ResolveAll(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 IEnumerable<TemplateModel> ResolveAll(this ITemplateResolver templateResolver, object item, TemplateTypeCategories category, IEnumerable<string> tags)
Parameters
Type Name Description
ITemplateResolver templateResolver

The template resolver 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> tags

The tags to use when selecting a template.

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

A TemplateModel object that contains information on the template.

Remarks

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