t4 scaffolding
DESCRIPTION
Presented at DevSum 12, Stockholm, Sweden. Build scalable T4 solutions using a composable library approach. Package them for sharing using NuGet. Make sure they have broad reach by making them extensible.TRANSCRIPT
<#@ template #>
<#@ output extension=“.txt” #>
<# for (int a=1; a<6; a++){#>
The answer is <#= a #>!
<# } #>
<# SayHello(); #>
<#+ void SayHello() { #>
Hello
<#+ } #>
The answer is 1!
The answer is 2!
The answer is 3!
The answer is 4!
The answer is 5!
Hello
public class Transform : TextTransformation
{
public string TransformText()
{
for (int a=1; a<6; a++){
Write(“The answer is “);
Write(a.ToString());
Write (“!\r\n”);
}
SayHello();
return GenerationEnvironment.ToString();
}
void SayHello()
{
Write(“Hello”);
}
}
Build include libraries
Package via NuGet
Enable scale out