init
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成
|
||||
// 生成时间 2019-12-10 12:14:04
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
<#@ assembly name="System.Core.dll" #>
|
||||
<#@ assembly name="System.Data.dll" #>
|
||||
<#@ assembly name="System.Data.DataSetExtensions.dll" #>
|
||||
<#@ assembly name="System.Xml.dll" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Xml" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Data" #>
|
||||
<#@ import namespace="System.Data.SqlClient" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ include file="$(ProjectDir)DbHelper.ttinclude" #>
|
||||
<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #>
|
||||
<# var manager = new Manager(Host, GenerationEnvironment, true); #>
|
||||
|
||||
|
||||
<#
|
||||
var OutputPath1 =Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Host.TemplateFile+"..")+"..")+"..");
|
||||
OutputPath1=Path.Combine(OutputPath1,"DouyinApi.IRepository","IRepositories_New");
|
||||
if (!Directory.Exists(OutputPath1))
|
||||
{
|
||||
Directory.CreateDirectory(OutputPath1);
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成
|
||||
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
<#
|
||||
var tableName=config.TableName;
|
||||
#>
|
||||
<#
|
||||
if(tableName!=""){
|
||||
#>
|
||||
using DouyinApi.IRepository.Base;
|
||||
using DouyinApi.Model.Models;
|
||||
namespace DouyinApi.IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// I<#=tableName#>Repository
|
||||
/// </summary>
|
||||
public interface I<#=tableName#>Repository : IBaseRepository<<#=tableName#>>
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
} else{
|
||||
|
||||
#>
|
||||
|
||||
<#
|
||||
SqlConnection conn = new SqlConnection(config.ConnectionString);
|
||||
conn.Open();
|
||||
System.Data.DataTable schema = conn.GetSchema("TABLES");
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach(System.Data.DataRow row in schema.Rows)
|
||||
{
|
||||
manager.StartBlock("I"+row["TABLE_NAME"].ToString()+"Repository"+".cs",OutputPath1);//文件名
|
||||
#>
|
||||
//----------<#=row["TABLE_NAME"].ToString()#>开始----------
|
||||
|
||||
|
||||
using DouyinApi.IRepository.Base;
|
||||
using DouyinApi.Model.Models;
|
||||
namespace DouyinApi.IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// I<#=row["TABLE_NAME"].ToString()#>Repository
|
||||
/// </summary>
|
||||
public interface I<#=row["TABLE_NAME"].ToString()#>Repository : IBaseRepository<<#=row["TABLE_NAME"].ToString()#>>//类名
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//----------<#=row["TABLE_NAME"].ToString()#>结束----------
|
||||
<#
|
||||
manager.EndBlock();
|
||||
}
|
||||
|
||||
{
|
||||
manager.StartBlock("IBaseRepository.cs",OutputPath1);//文件名
|
||||
#>
|
||||
|
||||
//----------开始----------
|
||||
|
||||
using DouyinApi.IRepository.Base;
|
||||
using DouyinApi.Model.Models;
|
||||
namespace DouyinApi.IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// IBaseRepository
|
||||
/// </summary>
|
||||
public interface IBaseRepository<TEntity> where TEntity : class
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//----------结束----------
|
||||
<#
|
||||
manager.EndBlock();
|
||||
}
|
||||
manager.Process(true);
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user