StringTemplate.NET实例3

时间:2009-11-07 阅读: 佚名
例如D:\temp\下有一个theQuery.st模板,内容如下 SELECT $column; separator=","$ FROM $table$; -----------------C#代码如下-------------------------------------- StringTemplateGroup group = new StringTemplateGroup("myGroup", "C:/temp"); StringTemplate query = group.GetInstanceOf("theQuery"); query.SetAttribute("column", "name"); query.SetAttribute("column", "email"); query.SetAttribut

例如D:\temp\下有一个theQuery.st模板,内容如下

SELECT $column; separator=","$ FROM $table$;


-----------------C#代码如下--------------------------------------

StringTemplateGroup group = new StringTemplateGroup("myGroup", "C:/temp");
StringTemplate query = group.GetInstanceOf("theQuery");
query.SetAttribute("column", "name");
query.SetAttribute("column", "email");
query.SetAttribute("table", "User");

-----------------结果如下--------------------------------------

SELECT name,email FROM User;

[责任编辑:jumbot]

[发表评论] [收藏本页]