直接上代码,只需要修改EF实体的地址就可以了。
<#@ 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 = @"..\\Search.Model\\SearchEngines.edmx"; //修改此处EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);string namespaceName = code.VsNamespaceSuggestion();EntityFrameworkTemplateFileManager fileManager = EntityFrameworkTemplateFileManager.Create(this);#>using System;using System.Collections.Generic;using System.Linq;using System.Text;using Search.Model;using Search.IDal;namespace Search.Dal{<#// Emit Entity Typesforeach (EntityType entity in ItemCollection.GetItems().OrderBy(e => e.Name)){ //fileManager.StartNewFile(entity.Name + "RepositoryExt.cs"); //BeginNamespace(namespaceName, code); #> public partial class <#=entity.Name#>Dal :BaseDal<<#=entity.Name#>>,I<#=entity.Name#>Dal { }<#}#> }