madhavrao… » Architecture of T4
Architecture of T4
The text template transformation process has three components: the host, the engine and the directive processor.
Engine: The engine component controls the process and interacts with the host and zero or more directive processors to complete the process.
Host: The host is responsible for all input and output, locating files and anything else related to external environment. Visual Studio is example of Host, one can create custom host by implementing interface ITextTemplatingEngineHost from Microsoft.VisualStudio.TextTemplate assembly. Details of Creating Custom Text Template Host are covered in MSDN
Directive Processors: Directive processors are classes that handle directives in text templates. One can typically use directives to provide data from an input source (for example, from a model) to a text template. When you use Domain-Specific Language Tools, a directive processor is generated for each domain-specific language, so that text templates can access the models in that language as input sources. One can also write custom directive processors. Details of Creating Custom Text Template Directive Processors is covered in MSDN.
Text Template Transformation process is a two step process, in first step temporary class (generated transformation class) is created based on text template and in second step engine complies and executes the generate transformation class to generate text output.
Leave a comment