Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introducing T4 Templates


Published on

Presented at DevEvening Melbourne # 1.

Published in: Technology, Business
  • Be the first to comment

Introducing T4 Templates

  1. 1. Introducing T4 Templates<br />Chris Melinn<br />
  2. 2. Agenda<br />This presentation will provide a short overview of T4. We will learn the basics of creating a template and then see a few examples of how T4 is used by others.<br />
  3. 3. The Basics<br />
  4. 4. What is T4?<br />T4 = <br />Text<br />Template<br />Transformation<br />Toolkit<br />
  5. 5. What is T4?<br />Generates any textual format <br />Common examples:<br /><ul><li>Code (C#, VB, etc)
  6. 6. SQL
  7. 7. XML</li></li></ul><li>But…<br />Editing T4 sucks *<br />* with the default Visual Studio setup<br />
  8. 8. The Default Visual Studio Editor<br />
  9. 9. Fortunately, there is a solution…<br />Free Visual T4 Editor<br />Community Edition<br />from Clarius Consulting<br />
  10. 10. The Visual T4 Editor (inside Visual Studio)<br />
  11. 11. DEMO #1<br />Creating Templates<br />
  12. 12. How it works<br />T4 engine performs two steps to generate output from a template:<br />Source: Oleg Sych<br />
  13. 13. Applications of T4<br />Examples of T4 in the wild<br />
  14. 14. “If you’re going to do something twice or more, manually, in your company, generate it.”<br />~ Scott Hanselman<br />
  15. 15. T4 can be used to generate…<br />
  16. 16. DEMO #2<br />ASP.NET MVC CodeTemplates<br />
  17. 17. DEMO #3<br />T4CSS<br />
  18. 18. Summary<br />For more information…<br />
  19. 19. Resources<br />Oleg Sych’sblog is the best collection of T4 resources I have found anywhere<br /><br />His CodePlex project, T4 Toolbox, contains several ready-to-use code generation templates and other supporting extensions.<br /><br />
  20. 20. Editing Tools<br />Visual T4 Editor from Clarius Consulting<br /><br />Tangible T4 Editor by Tangible Engineering<br /><br />
  21. 21. Other Examples of T4<br />T4CSS<br /><br />T4MVC: Creates strongly typed helpers to eliminate your “magic strings”<br /><br />Generate WPF and Silverlight Dependency Properties using T4<br /><br />
  22. 22. Contact Me<br />Blog:<br />Twitter:<br />