1
我的MyModel.tt用於我的實體模型(MyModel)。我需要修改我的MyModel.tt文件。我想要的是我的simpleProperties在一個類中寫入,而navigationProperties和complexProperties在其他類中寫入。我找到了線,但現在完全空白做什麼。修改t4模板以在兩個文件中生成寫入文本
這是代碼(我認爲)我必須編寫代碼,它將在不同的類中編寫屬性。
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
// TODO: Write this in entityName.cs
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
// TODO: Write this in entityNameComplex.cs
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}