83 lines
3.0 KiB
Plaintext
83 lines
3.0 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); #>
|
|
|
|
|
|
|
|
<#
|
|
var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+"..");
|
|
OutputPath1=Path.Combine(OutputPath1,"Dto_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(tableName+"ViewModel"+".cs",OutputPath1);//文件名
|
|
#>
|
|
//--------------------------------------------------------------------
|
|
// 此代码由T4模板自动生成 byzhouhang 20210918
|
|
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
|
//--------------------------------------------------------------------
|
|
using System;
|
|
using IRaCIS.Core.Domain.Share;
|
|
using System.Collections.Generic;
|
|
namespace IRaCIS.Core.Application.ViewModel
|
|
{
|
|
/// <summary> <#=tableName#>View 列表视图模型 </summary>
|
|
public class <#=tableName#>View
|
|
{
|
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
|
<# }#>
|
|
}
|
|
|
|
///<summary><#=tableName#>Query 列表查询参数模型</summary>
|
|
public class <#=tableName#>Query
|
|
{
|
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#><# if(column.CSharpType=="string"){#>
|
|
///<summary> <#= column.Remark == "" ? column.ColumnName : column.Remark.Replace("\r\n","") #></summary>
|
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
|
|
|
<# }#>
|
|
<# }#>
|
|
}
|
|
|
|
///<summary> <#=tableName#>AddOrEdit 列表查询参数模型</summary>
|
|
public class <#=tableName#>AddOrEdit
|
|
{
|
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
|
<# }#>
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
<#
|
|
manager.EndBlock();
|
|
}
|
|
manager.Process(true);
|
|
#>
|
|
|
|
|