Class TemplatePathResolver

The TemplatePathResolver resolves path to the requested render type.

Inheritance
System.Object
TemplatePathResolver
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.dll
Version: 8.11.0
Syntax
[ServiceConfiguration(typeof(ITemplatePathResolver), Lifecycle = ServiceInstanceScope.Singleton)]
public class TemplatePathResolver : ITemplatePathResolver
Examples

The following code example demonstrates how to exchange the template path for requests.

Constructors

TemplatePathResolver(IHostingEnvironment, ModuleTable)

Initializes a new instance of the ResolvingTemplatePath class.

Declaration
public TemplatePathResolver(IHostingEnvironment hostingEnvironment, ModuleTable moduleTable)
Parameters
Type Name Description
IHostingEnvironment hostingEnvironment

The hosting environment.

ModuleTable moduleTable

The Shell module table.

Methods

ResolvePath(Type, TemplateTypeCategories)

Resolves the path for the requested render type.

Declaration
public virtual string ResolvePath(Type type, TemplateTypeCategories templateTypeCategory)
Parameters
Type Name Description
System.Type type

The render type.

TemplateTypeCategories templateTypeCategory

The type of template.

Returns
Type Description
System.String

returns path to the render template.

Remarks

The ResolvePath resolves path by following order

  1. Resolves path by raising ResolvingTemplatePath event
  2. Resolves path from root of application according to namespace e.g. if the namespace is like A.B.C and the typename is X then the searching paths are (~/A/B/C/X, ~/B/C/X, ~/C/X, ~/X)
  3. Resolves path from root of corresponding Shell module according to namespace e.g. if the namespace is like A.B.C, typename is X and the Shell module path is M then the searching paths are (~/M/A/B/C/X, ~/M/B/C/X, ~/M/C/X, ~/M/X)

ResolvePath(Type, String, String)

Creates the path from namespace.

Declaration
protected virtual string ResolvePath(Type type, string basePath, string extension)
Parameters
Type Name Description
System.Type type

The type.

System.String basePath

The base path.

System.String extension

The extension.

Returns
Type Description
System.String

ResolvePathByTypeOfTemplate(Type, String, TemplateTypeCategories)

Resolves the path by type of template.

Declaration
protected virtual string ResolvePathByTypeOfTemplate(Type type, string basePath, TemplateTypeCategories templateTypeCategory)
Parameters
Type Name Description
System.Type type

The type.

System.String basePath

The base path.

TemplateTypeCategories templateTypeCategory

The type of template.

Returns
Type Description
System.String

Events

ResolvingTemplatePath

Occurs when [template path resolver event].

Declaration
public event EventHandler<ResolvingTemplatePathEventArgs> ResolvingTemplatePath
Event Type
Type Description
System.EventHandler<ResolvingTemplatePathEventArgs>

Implements

Extension Methods