Q:

T4 Output to String

I am new to T4, I want to generate CRUD Stored Procedures, Data access layer, output to string, I am trying to create kind of webservice api to be useful to other programmers also, just input the data, and download zip file.
I have searched a lot but could not find a way to generate output to string, is it possible, any articles, links, a bit of code if possible would be helpful.
Yes, we can also use StringBuilder, but The question is "T4 Output to String" please all type of answers are welcome, but try to focus on the question.

A:

You can use preprocessed T4 templates to return a string instead of generating a file.
If you change the Custom Tools property on the file in Visual Studio to TextTemplatingFilePreprocessor then when you save the T4 template a class will be generated. This class will have a TransformText method which returns the generated text.
MSDN also has information on run-time text generation with preprocessed T4 templates.

