Question

I think I understand the basic principals of T4 but I'm having a hard time figuring out how to apply it to my particular situation.

I have an application that display lists of objects of some kind - doesn't matter what. I want to allow the users to select 1 or more of these objects and submit them to any template. The template could generate, for example, an html file describing the objects or a powershell script to manipulate them in some way or whatever.

The thing I cant figure out is how to pass the selected objects into my custom host.

I could create an extensive tt include file that called my own api to retrieve these objects from their storage, but this seems silly when I already have instances of the objects in scope and I just want to examine them to produce some text output.

I hope this makes sense...

I have tried adding properties to my host and then using the hostspecific setting I thought I could use the objects via these properties but all I get is errors about serialization and such stuff.

A really good example of how to do this would be fantastic :)

Thanks

Was it helpful?

Solution

Perhaps this article will answer your question. "Standalone Template" may be the best design option. Other options are environment variables and external files. However, I hope you decide against using a custom host (unless you want to have your own, unique flavor of T4, likely incompatible with any other T4 host out there) and use TextTransform.exe instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top