У меня есть шаблон, который генерирует класс и дополнительный интерфейс, чтобы пойти с ним из сценария, например так:
<#@ template language="C#v3.5" hostspecific="True" debug="True" #>
<#@ output extension="cs" #>
<#@ include file="T4Toolbox.tt" #>
<#@ include file="../BusinessObjectTemplate.tt" #>
<#
BusinessObjectTemplate template = new BusinessObjectTemplate();
template.BusinessName="Priority";
template.PropertyList=new Dictionary<string,BusinessPropertyT4>{
{"Value",new BusinessPropertyT4("byte")},
{"Display",new BusinessPropertyT4("string")},
};
template.TopRegionText="internal ModelPriority(byte value, String display)\r\n\t\t{\r\n"+
"\t\t\tValue=value;\r\n"+"\t\t\tDisplay=display;\r\n"+ "\t\t}";
template.Render();
#>
Как бы я сгенерировал TopRegionText
(конструктор) из скрипта, не передавая ему прямую строку и поместив его в нужное место в шаблоне?