T4 Templates
This course introduces T4, Microsoft's code generation tool that comes with Visual Studio. The Text Template Transformation Toolkit dynamically produces text of any type and is used for code and document generation. Discover how to reduce development time, bugs and maintenance by building reusable templates. This course covers T4 template building blocks, extending templates with custom functionality and debugging the template execution process. MVC and Entity Framework, among others, can be customized and extended through T4 templates. This course covers how to customize MVC controllers using the default templates and the MVCScaffolding package, and customizing entities by adding validation attributes. Top it off with real world uses of T4 including generating, and automatically synchronizing, code based on external resources, and combining T4 with other technologies to produce powerful templates.
| expand all | collapse all | Progress | Duration | |
|---|---|---|---|
Introduction |
|
00:06:12 | |
|
Outline
|
|
00:28 | |
|
What T4 is
|
|
01:13 | |
|
What T4 does
|
|
01:02 | |
|
T4 templates types
|
|
01:02 | |
|
The benefits of using T4
|
|
01:00 | |
|
T4 in the wild
|
|
00:52 | |
|
Summary
|
|
00:35 | |
Getting Started with T4 |
|
00:11:15 | |
|
Outline
|
|
00:21 | |
|
Adding templates to projects
|
|
00:53 | |
|
A word of caution
|
|
00:51 | |
|
Template basics
|
|
03:10 | |
|
Executing templates
|
|
03:55 | |
|
Editing templates
|
|
01:34 | |
|
Summary
|
|
00:31 | |
T4 Building Blocks |
|
00:24:44 | |
|
Outline
|
|
00:26 | |
|
Expression, statement and class feature blocks
|
|
04:31 | |
|
Assembly, import and include directives
|
|
04:44 | |
|
Output formatting and utility methods
|
|
06:52 | |
|
Demo: Connection string helper
|
|
07:47 | |
|
Summary
|
|
00:24 | |
Extended T4 |
|
00:16:32 | |
|
Outline
|
|
00:24 | |
|
Using custom utility methods
|
|
03:59 | |
|
Exploring preprocessed templates
|
|
06:51 | |
|
Extending preprocessed templates
|
|
02:03 | |
|
Template parameters
|
|
02:33 | |
|
Summary
|
|
00:42 | |
Real world examples |
|
00:27:17 | |
|
Outline
|
|
00:31 | |
|
Building code from external resources
|
|
05:14 | |
|
Automating code synchronization
|
|
01:50 | |
|
Setting up template reuse
|
|
01:54 | |
|
Code generation - implementing INotifyPropertyChanged
|
|
06:42 | |
|
T4 with MVC
|
|
07:03 | |
|
T4 with Entity Framework
|
|
03:14 | |
|
Summary
|
|
00:49 | |
Troubleshooting and debugging |
|
00:09:27 | |
|
Outline
|
|
00:23 | |
|
Identifying and troubleshooting errors
|
|
04:33 | |
|
Debugging templates
|
|
02:23 | |
|
Tips and tricks
|
|
01:20 | |
|
Summary
|
|
00:48 |
Introduction