Extend T4 code generator to create multiple files from one model with one template.
Custom code generation becomes more and more important. For example network messages can be described using .xls file (each message field is one Excel cell).
At the moment T4 cannot be used to gen multiple files from one model with one template.
In case of networking multiple files must be generated: a class file per message, a switch method for dispatching messages, a parser, an asynch handler of messages and timeouts, ...
4 comments
-
Doug Allen
commented
This feature already exists. Look at the t4 templates that are created by Entity Framework 4. They generate one file per entity
-
Anonymous
commented
I am using the tangible T4 Editor that comes with a reusable sample of how to create multiple output files. Maybe you want to check this out.
-
Emil
commented
This is a feature I needed in T4 in the past. Definitely gets my vote +1
-
Michael Paterson commented
I would TOTALLY vote for this if I had any left. In addition I would throw in the option to prevent the default file generation. Ie. if you have MyTestFile.tt that actually generated 4 other files and nothing in MyTestFile.cs, it would be nice to be able to turn off the generation of MyTestFile.cs.