首页 > 代码库 > T4模板
T4模板
生成接口、类需要指定为局部partial,个性功能在自定义接口、类完成。
<#@ 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 = @"..\\CZBK.ItcastOA.Model\\Model1.edmx";EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);string namespaceName = code.VsNamespaceSuggestion();EntityFrameworkTemplateFileManager fileManager = EntityFrameworkTemplateFileManager.Create(this);#>using CZBK.ItcastOA.Model;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CZBK.ItcastOA.IDAL{ <#// Emit Entity Typesforeach (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#>> { }<#}#> }
T4模板
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。