C# Class SharpTAL.TemplateCache.AbstractTemplateCache

Inheritance: ITemplateCache
ファイルを表示 Open project: lck/SharpTAL

Public Methods

Method Description
CompileTemplate ( string templateBody, Type>.Dictionary globalsTypes, List referencedAssemblies ) : TemplateInfo

Compile template to ensure that the compiled assembly is already in cache when RenderTemplate is called for the first time. For precompiling, the actual values of globals are not required, just the names and types of the global variables.

Protected Methods

Method Description
ComputeTemplateKey ( TemplateInfo ti ) : string

Returns a unique key that represent the template in the template cache. The template key is computed from the following parts: Template body hash, Global types hash, Imported templates hash, Referenced assemblies hash

GenerateTemplateProgram ( string templateBody, Type>.Dictionary globalsTypes, List referencedAssemblies ) : TemplateInfo

Generate template program from template body and generate the TemplateKey

GetTemplateGeneratorVersion ( Assembly assembly, TemplateInfo ti ) : string

Try to find the template source generator version

GetTemplateRenderMethod ( Assembly assembly, TemplateInfo ti ) : MethodInfo

Try to find the render method in assembly

Method Details

CompileTemplate() public abstract method

Compile template to ensure that the compiled assembly is already in cache when RenderTemplate is called for the first time. For precompiling, the actual values of globals are not required, just the names and types of the global variables.
public abstract CompileTemplate ( string templateBody, Type>.Dictionary globalsTypes, List referencedAssemblies ) : TemplateInfo
templateBody string The template body
globalsTypes Type>.Dictionary Dictionary of types of global variables
referencedAssemblies List List of referenced assemblies
return TemplateInfo

ComputeTemplateKey() protected static method

Returns a unique key that represent the template in the template cache. The template key is computed from the following parts: Template body hash, Global types hash, Imported templates hash, Referenced assemblies hash
protected static ComputeTemplateKey ( TemplateInfo ti ) : string
ti TemplateInfo Template info
return string

GenerateTemplateProgram() protected static method

Generate template program from template body and generate the TemplateKey
protected static GenerateTemplateProgram ( string templateBody, Type>.Dictionary globalsTypes, List referencedAssemblies ) : TemplateInfo
templateBody string
globalsTypes Type>.Dictionary
referencedAssemblies List
return TemplateInfo

GetTemplateGeneratorVersion() protected static method

Try to find the template source generator version
protected static GetTemplateGeneratorVersion ( Assembly assembly, TemplateInfo ti ) : string
assembly System.Reflection.Assembly
ti TemplateInfo
return string

GetTemplateRenderMethod() protected static method

Try to find the render method in assembly
protected static GetTemplateRenderMethod ( Assembly assembly, TemplateInfo ti ) : MethodInfo
assembly System.Reflection.Assembly
ti TemplateInfo
return System.Reflection.MethodInfo