O'Reilly logo

Fluent Entity Framework by Rebecca M. Riordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing T4 templates

T4 templates can contain three types of content: literal text that will be copied directly to the output files, template directives which, just like a compiler directive, control how the TextTemplatingFileGenerator creates the file, and C# or VB code contained in what T4 calls a CONTROL BLOCK.

Image

Directives

T4 directives control how TextTemplatingFileGenerator creates the output file. They are wrapped inside <#@ and #> characters. The attributes must be included in quotation marks. The full list of directives and their attributes is available on MSDN (search for “Writing a T4 Text Template”), but here are the ones we’ll be using: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required