Class TemplateGenerator
Inheritance
System.Object
TemplateGenerator
Implements
ITextTemplatingSessionHost
Assembly: cs.temp.dll.dll
Syntax
public class TemplateGenerator : ITextTemplatingEngineHost, ITextTemplatingSessionHost
Constructors
TemplateGenerator()
Declaration
public TemplateGenerator()
Properties
Engine
Declaration
protected TemplatingEngine Engine { get; }
Property Value
Errors
Declaration
public CompilerErrorCollection Errors { get; }
Property Value
Type |
Description |
CompilerErrorCollection |
|
Imports
Declaration
public List<string> Imports { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<System.String> |
|
IncludePaths
Declaration
public List<string> IncludePaths { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<System.String> |
|
OutputFile
Declaration
public string OutputFile { get; protected set; }
Property Value
Type |
Description |
System.String |
|
ReferencePaths
Declaration
public List<string> ReferencePaths { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<System.String> |
|
Refs
Declaration
public List<string> Refs { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<System.String> |
|
SpecificHostType
If non-null, the template's Host property will be the full type of this host.
Declaration
public virtual Type SpecificHostType { get; }
Property Value
Type |
Description |
System.Type |
|
TemplateFile
Declaration
public string TemplateFile { get; protected set; }
Property Value
Type |
Description |
System.String |
|
UseRelativeLinePragmas
Declaration
public bool UseRelativeLinePragmas { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
AddDirectiveProcessor(String, String, String)
Declaration
public void AddDirectiveProcessor(string name, string klass, string assembly)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.String |
klass |
|
System.String |
assembly |
|
AddParameter(String, String, String, String)
Declaration
public void AddParameter(string processorName, string directiveName, string parameterName, string value)
Parameters
Type |
Name |
Description |
System.String |
processorName |
|
System.String |
directiveName |
|
System.String |
parameterName |
|
System.String |
value |
|
CompileTemplate(String)
Declaration
public CompiledTemplate CompileTemplate(string content)
Parameters
Type |
Name |
Description |
System.String |
content |
|
Returns
CreateSession()
Called to create a session instance.
Can be overridden to return a different implementation.
Declaration
protected virtual ITextTemplatingSession CreateSession()
Returns
Type |
Description |
ITextTemplatingSession |
|
GetAdditionalDirectiveProcessors()
Gets any additional directive processors to be included in the processing run.
Declaration
public virtual IEnumerable<IDirectiveProcessor> GetAdditionalDirectiveProcessors()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IDirectiveProcessor> |
|
GetHostOption(String)
Declaration
public virtual object GetHostOption(string optionName)
Parameters
Type |
Name |
Description |
System.String |
optionName |
|
Returns
Type |
Description |
System.Object |
|
GetOrCreateSession()
Returns the current session instance, creating it if necessary.
Declaration
public ITextTemplatingSession GetOrCreateSession()
Returns
Type |
Description |
ITextTemplatingSession |
|
LoadIncludeText(String, out String, out String)
Declaration
protected virtual bool LoadIncludeText(string requestFileName, out string content, out string location)
Parameters
Type |
Name |
Description |
System.String |
requestFileName |
|
System.String |
content |
|
System.String |
location |
|
Returns
Type |
Description |
System.Boolean |
|
PreprocessTemplate(String, String, String, String, Encoding, out String, out String[])
Declaration
public bool PreprocessTemplate(string inputFile, string className, string classNamespace, string outputFile, Encoding encoding, out string language, out string[] references)
Parameters
Type |
Name |
Description |
System.String |
inputFile |
|
System.String |
className |
|
System.String |
classNamespace |
|
System.String |
outputFile |
|
Encoding |
encoding |
|
System.String |
language |
|
System.String[] |
references |
|
Returns
Type |
Description |
System.Boolean |
|
PreprocessTemplate(String, String, String, String, out String, out String[], out String)
Declaration
public bool PreprocessTemplate(string inputFileName, string className, string classNamespace, string inputContent, out string language, out string[] references, out string outputContent)
Parameters
Type |
Name |
Description |
System.String |
inputFileName |
|
System.String |
className |
|
System.String |
classNamespace |
|
System.String |
inputContent |
|
System.String |
language |
|
System.String[] |
references |
|
System.String |
outputContent |
|
Returns
Type |
Description |
System.Boolean |
|
ProcessTemplate(String, String)
Declaration
public bool ProcessTemplate(string inputFile, string outputFile)
Parameters
Type |
Name |
Description |
System.String |
inputFile |
|
System.String |
outputFile |
|
Returns
Type |
Description |
System.Boolean |
|
ProcessTemplate(String, String, ref String, out String)
Declaration
public bool ProcessTemplate(string inputFileName, string inputContent, ref string outputFileName, out string outputContent)
Parameters
Type |
Name |
Description |
System.String |
inputFileName |
|
System.String |
inputContent |
|
System.String |
outputFileName |
|
System.String |
outputContent |
|
Returns
Type |
Description |
System.Boolean |
|
ProvideTemplatingAppDomain(String)
Declaration
public virtual AppDomain ProvideTemplatingAppDomain(string content)
Parameters
Type |
Name |
Description |
System.String |
content |
|
Returns
Type |
Description |
System.AppDomain |
|
ResolveAssemblyReference(String)
Declaration
protected virtual string ResolveAssemblyReference(string assemblyReference)
Parameters
Type |
Name |
Description |
System.String |
assemblyReference |
|
Returns
Type |
Description |
System.String |
|
ResolveDirectiveProcessor(String)
Declaration
protected virtual Type ResolveDirectiveProcessor(string processorName)
Parameters
Type |
Name |
Description |
System.String |
processorName |
|
Returns
Type |
Description |
System.Type |
|
ResolveParameterValue(String, String, String)
Declaration
protected virtual string ResolveParameterValue(string directiveId, string processorName, string parameterName)
Parameters
Type |
Name |
Description |
System.String |
directiveId |
|
System.String |
processorName |
|
System.String |
parameterName |
|
Returns
Type |
Description |
System.String |
|
ResolvePath(String)
Declaration
protected virtual string ResolvePath(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
TryAddParameter(String)
Parses a parameter and adds it.
Declaration
public bool TryAddParameter(string unparsedParameter)
Parameters
Type |
Name |
Description |
System.String |
unparsedParameter |
Parameter in name=value or processor!directive!name!value format.
|
Returns
Type |
Description |
System.Boolean |
Whether the parameter was parsed successfully.
|
TryParseParameter(String, out String, out String, out String, out String)
Declaration
public static bool TryParseParameter(string parameter, out string processor, out string directive, out string name, out string value)
Parameters
Type |
Name |
Description |
System.String |
parameter |
|
System.String |
processor |
|
System.String |
directive |
|
System.String |
name |
|
System.String |
value |
|
Returns
Type |
Description |
System.Boolean |
|
Implements
ITextTemplatingSessionHost