EI-Image-Viewer-Api/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt

79 lines
2.5 KiB
Plaintext

<#@ 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); #>
//在这里设置 isPage 是否生成分页的还是不分页
<#
var isPage=false;
#>
<#
var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+"..");
OutputPath1=Path.Combine(OutputPath1,"IServices_New");
if (!Directory.Exists(OutputPath1))
{
Directory.CreateDirectory(OutputPath1);
}
#>
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
{
var tableName=item.ToString();
manager.StartBlock("I"+tableName+"Service"+".cs",OutputPath1);//文件名
#>
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using System.Collections.Generic;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Core.Application.Contracts
{
/// <summary>
/// I<#=tableName#>Service
/// </summary>
public interface I<#=tableName#>Service
{
<# if(isPage){#>
PageOutput<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>);
<# } else {#>
List<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>);
<# }#>
IResponseOutput AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>);
IResponseOutput Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id);
}
}
<#
manager.EndBlock();
}
manager.Process(true);
#>