修改T4模板
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-08-16 09:54:06 +08:00
parent 3701d8bcd9
commit 423fa4001b
4 changed files with 34 additions and 33 deletions

View File

@ -77,11 +77,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>IRaCIS.Core.Dto.tt</DependentUpon>
</Compile>
<Compile Update="TT_Template\IRaCIS.Core.Entity.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>IRaCIS.Core.Entity.tt</DependentUpon>
</Compile>
<Compile Update="TT_Template\IRaCIS.Core.IRepository.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@ -102,12 +97,18 @@
<AutoGen>True</AutoGen>
<DependentUpon>IRaCIS.Core.Services.tt</DependentUpon>
</Compile>
<Compile Update="TT_Template\IRaCIS.Core.Entity.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>IRaCIS.Core.Entity.tt</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="TT_Template\Dto_New\" />
<Folder Include="TT_Template\IServices_New\" />
<Folder Include="TT_Template\Models_New\" />
<Folder Include="TT_Template\Repositories_New\" />
<Folder Include="TT_Template\Services_New\" />
</ItemGroup>

View File

@ -42,30 +42,34 @@ using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> <#=tableName#>View 列表视图模型 </summary>
public class <#=tableName#>View
<# var excludedColumns = new[] { "CreateUserId", "UpdateUserId", "CreateTime", "UpdateTime" };#>
/// <summary> <#=tableName#>View 列表视图 </summary>
public class <#=tableName#>View:<#=tableName#>AddOrEdit
{
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
<# if (excludedColumns.Contains(column.ColumnName)){ #>
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
<# }#>
<# }#>
}
///<summary><#=tableName#>Query 列表查询参数模型</summary>
///<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; }
<# }#>
<# }#>
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#><# if(column.CSharpType=="string"){#>
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
<# }#>
<# }#>
}
///<summary> <#=tableName#>AddOrEdit 列表查询参数模型</summary>
///<summary> <#=tableName#>AddOrEdit 添加编辑</summary>
public class <#=tableName#>AddOrEdit
{
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
<# if (!excludedColumns.Contains(column.ColumnName)){ #>
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
<#}#>
<# }#>
}

View File

@ -1,3 +1,3 @@


View File

@ -1,4 +1,4 @@
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ assembly name="System.Core.dll" #>
<#@ assembly name="System.Data.dll" #>
@ -27,13 +27,13 @@
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
{
var tableName=item.ToString();
manager.StartBlock(tableName+".cs",OutputPath1);//文件名
manager.StartBlock(tableName+".cs",OutputPath1);//文件名
#>
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
using System;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
@ -44,19 +44,15 @@ namespace IRaCIS.Core.Domain.Models
///<#=tableName#>
///</summary>
[Table("<#=tableName#>")]
public class <#=tableName#> : Entity, IAuditUpdate, IAuditAdd
public class <#=tableName#> : BaseFullAuditEntity
{
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
/// <summary>
/// <#= column.Remark == "" ? column.ColumnName : column.Remark.Replace("\r\n"," ") #>
/// </summary>
<#
if(column.IsPrimaryKey)
{#>[Key]
<#}#><# if(!column.IsNullable) {#>[Required]
<# }#>public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
<#}#>
<# var excludedColumns = new[] { "CreateUserId", "Id", "UpdateUserId", "CreateTime", "UpdateTime", "DeleteUserId", "IsDeleted", "DeletedTime" };#>
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){ #>
<# if (!excludedColumns.Contains(column.ColumnName)){ #>
/// <summary> <#= column.Remark == "" ? column.ColumnName : column.Remark.Replace("\r\n"," ") #> </summary>
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
<#}#>
<#}#>
}
public virtual DbSet<<#=tableName#>> <#=tableName#> { get; set; }