What is purpose of T4 Generator in T4toolbox
I am using T4toolbox, I am confused what the generator is for. I can run the following
public class Generator1 : Generator
{
protected override void RunCore()
{
Template1 t = new Template1();
t.Output.File = "t3.txt";
t.Render();
}
}
or I can run t4 script directly like the following.
Templat开发者_JAVA百科e1 t = new Template1();
t.Output.File = "t3.txt";
t.Render();
But I can do the same using t4 script without generator as well. So I mean can do the same thing with two approach "script --> generator --> template" and "script --> template", am I missing something?
Generator class is useful when want to encapsulate multiple templates. More here: http://www.olegsych.com/2008/09/t4-tutorial-creating-complex-code-generators/
精彩评论