18
T4

T4 Templates

Embed Size (px)

DESCRIPTION

An introduction to T4 templates

Citation preview

Page 1: T4 Templates

T4

Page 2: T4 Templates

Overture• Level 01-01-02• Interactive

• On the Menu– What it is?– Demo– Alternatives– Learning’s

Page 4: T4 Templates

TLA• What does T4 stand for?• Text Template Transformation Toolkit

Three Two Letter Acronym

Page 5: T4 Templates

Why do we need it?• Cause developers are expensive and Xbox games

are fun

Page 6: T4 Templates

History

2005 Shipped out of band platform

2008 Shipped platform with Visual Studio

2010MAJOR enhancements to platformSomething is missing here…

Page 7: T4 Templates

A word of warning…• Out of the box tooling DOES NOT EXIST– It’s notepad + command line basically

• 3rd parties can make the pain go away– I use the free stuff from Tangible & T4 Toolbox– You will too, accept that and move on

Page 8: T4 Templates

Is this thing used?• ASP.MVC uses T4 templates for views and controllers• DSL tools in VS 2010 use it– BizTalk– Architecture Tools

• 3rd Party uses like LINQ to SQL replacement

Page 9: T4 Templates

High Level Plan

Template Code OutputT4 toolkit .NET Framework

C#

VBHTML

XAMLCSV

Page 10: T4 Templates

DEMOSLIKE THE MOON LANDING DEMOS TAKE LOTS OF PREPARATION, LEARNING NEW SKILLS AND MOSTLY FAKING IT

Page 11: T4 Templates

What haven’t you seen?

• Build integration• Pre-processed Templates

Page 12: T4 Templates

Alternatives• CodeDOM– Part of .NET– Used internally by T4– More powerful– Harder to learn– Ideally for language scenarios

Page 13: T4 Templates

Alternatives• CodeSmith– Third Party– $$$– More rugged tooling, debugging features

Page 14: T4 Templates

Alternatives• NVelocity– Port of Java’s Jakata Velocity– Free– Wildly different syntax

Page 15: T4 Templates

Alternatives• Hire a monkey

• Maybe this is why you were hired…

Page 16: T4 Templates

Help?

Page 17: T4 Templates

Learning's• Search for T4 AND Visual Studio Text Template • Use the Tangible T4 editor• Use the T4 Toolkit• Make use of scratch applications in prototyping• For use within Visual Studio

Page 18: T4 Templates

QUESTIONS

[email protected]@rmaclean