文本模板转换引擎。
继承层次结构
Object
Microsoft.VisualStudio.TextTemplating.Engine
命名空间: Microsoft.VisualStudio.TextTemplating
程序集: Microsoft.VisualStudio.TextTemplating.12.0(在 Microsoft.VisualStudio.TextTemplating.12.0.dll 中)
语法
声明
Public Class Engine _
Implements ITextTemplatingEngine, IDebugTextTemplatingEngine
public class Engine : ITextTemplatingEngine, IDebugTextTemplatingEngine
public ref class Engine : ITextTemplatingEngine, IDebugTextTemplatingEngine
type Engine =
class
interface ITextTemplatingEngine
interface IDebugTextTemplatingEngine
end
public class Engine implements ITextTemplatingEngine, IDebugTextTemplatingEngine
Engine 类型公开以下成员。
构造函数
名称 | 说明 | |
---|---|---|
![]() |
Engine | 初始化 Engine 类的新实例。 |
页首
方法
名称 | 说明 | |
---|---|---|
![]() |
Equals | 确定指定的对象是否等于当前对象。 (继承自 Object。) |
![]() |
Finalize | 在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。 (继承自 Object。) |
![]() |
GetHashCode | 作为默认哈希函数。 (继承自 Object。) |
![]() |
GetType | 获取当前实例的 Type。 (继承自 Object。) |
![]() |
MemberwiseClone | 创建当前 Object 的浅表副本。 (继承自 Object。) |
![]() |
PrepareTransformationRun | 准备一个或多个 IDebugTransformationRun 对象运行模板。 |
![]() |
PreprocessTemplate | 会从模板的代码,程序中,当编译和运行时,将产生模板输出。 |
![]() |
ProcessTemplate | 转换文本模板文件的内容以产生生成文本输出。 |
![]() |
ToString | 返回表示当前对象的字符串。 (继承自 Object。) |
页首
字段
名称 | 说明 | |
---|---|---|
![]() ![]() |
CacheAssembliesOptionString | CacheAssemblies 选字符串。 |
![]() ![]() |
TemplateFileParameterName |
页首
备注
文本模板转换过程将文本模板文件作为输入并生成一个新的文本文件作为输出。 文本模板转换引擎控制组件进程并与 文本模板转换宿主 进行交互,以及一个或多个文本模板指令处理器完成过程。 有关详细信息,请参阅代码生成和 T4 文本模板。
提示
如果要编写将在 Visual Studio内运行的包或扩展,请考虑使用文本模板化服务而不是编写您自己的主机。有关详细信息,请参阅在 VS 扩展中调用文本转换。
示例
下面的示例演示如何创建 Engine 的实例,以及调用 ProcessTemplate 来转换文本模板。
此代码示例摘自为 ITextTemplatingEngineHost 接口提供的一个更大的示例。
Engine engine = new Engine();
//read the text template
string input = File.ReadAllText(templateFileName);
//transform the text template
string output = engine.ProcessTemplate(input, host);
Dim engine As Engine = New Engine()
'read the text template
Dim input As String = File.ReadAllText(templateFileName)
'transform the text template
Dim output As String = engine.ProcessTemplate(input, host)
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
请参阅
参考
Microsoft.VisualStudio.TextTemplating 命名空间