开发者

Is T4 template run every time it is requested?

开发者 https://www.devze.com 2023-03-10 01:11 出处:网络
I am trying to setup an environment which would let me use a template to send out email to thousands of people. In all of this, per开发者_Go百科formance is a key and I am trying to find out,

I am trying to setup an environment which would let me use a template to send out email to thousands of people. In all of this, per开发者_Go百科formance is a key and I am trying to find out, when myscript.tt is run, is it compiled and executed every time or is there a compiled object that can be reused for subsequent calls to execute the script?


Basically, you call this in a pre-compiled template:

string result = new MyTemplate().TransformText();

The template and its code (logic, etc) is created once but you then call the TransformText to generate the dynamically desired output. In your case I think you feed your template with different e-mail addresses each time you call TransformText.

This post will answer your question:

Run-Time Text Generation with T4 Text Templates

More details here:

Writing Code that Writes Code

0

精彩评论

暂无评论...
验证码 换一张
取 消