摘取别人的。https://www.cnblogs.com/lzrabbit/archive/2012/07/15/2591085.html
写下几个要点:
1.控制块不能嵌套控制块。
2.被<# #>包含是控制块。<#= #>参数。没有被包含的是文本块
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#>
<#
CodeGenerationTools code = new CodeGenerationTools(this);
MetadataLoader loader = new MetadataLoader(this);
CodeRegion region = new CodeRegion(this, 1);
MetadataTools ef = new MetadataTools(this);
string inputFile = @"..\\Model\\Model1.edmx";
EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);
string namespaceName = code.VsNamespaceSuggestion();
EntityFrameworkTemplateFileManager fileManager = EntityFrameworkTemplateFileManager.Create(this);
#>
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IDAL
{
<#
// Emit Entity Types
foreach (EntityType entity in ItemCollection.GetItems<EntityType>().OrderBy(e => e.Name))
{
//fileManager.StartNewFile(entity.Name + "RepositoryExt.cs");
//BeginNamespace(namespaceName, code);
#>
public partial interface I<#=entity.Name#>Dal :IBaseDal<<#=entity.Name#>>
{
}
<#}#>
}