I am using Preprocessed Text Templates
(.tt
) . How can I pass object to another included Preprocessed Text Template
? I checked the documentation but didn't find any sample to do that.
Thanks
I am using Preprocessed Text Templates
(.tt
) . How can I pass object to another included Preprocessed Text Template
? I checked the documentation but didn't find any sample to do that.
Thanks
If you look at the generated code from your preprocessed template, you'll see that it is just a partial class. A great way to pass in data is simply to add another partial of the class, and provide a member and Getter/Setter pair for it. If you then include some further code in that preprocessed template, it will contribute to the same class, so your added member will still be available. If on the other hand, your included code is just class feature clocks (<#+ #>), then you'll likely be defining methods that you can call, in which case you can simply add your data to pass as an extra parameter to those methods.