How can I specify a T4 template to generate the resulting file with the given name?
I will try to be more clear. Say I have a template called Insert.tt that generates code to insert a record into a table. It has the output extension "sql", so it creates a file with the name:
Insert.sql
This is fine, but I would like the file name to reflect what I'm trying to do. Let's say that the name of the table in which I create Insert for is stored in <# = TableName #>. I would like to pass this to the template generator and use it to save the resulting file.
i.e. <# SaveTemplateAs ("Insert" + TableName); #>
So, let's say I generate Insert statements for the User, Address, and Phone tables.
I want the resulting files to be named InsertUser.sql, InsertAddress.sql and InsertPhone.sql.
I am sure that this can be done, since I saw some custom extensions for generating several files from one template, but I do not understand a simple (not too big) way to do this.
thanks
t4
Todd davis
source share