tags:

views:

126

answers:

1

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.

Template1 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?

+2  A: 

Generator class is useful when want to encapsulate multiple templates. More here: http://www.olegsych.com/2008/09/t4-tutorial-creating-complex-code-generators/

Oleg Sych