修改官方t4模板,适配我们自己的程序
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-09-08 17:39:47 +08:00
parent c7e80401e1
commit 564477b728
1 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,7 @@
usings.Add("System.ComponentModel.DataAnnotations");
usings.Add("System.ComponentModel.DataAnnotations.Schema");
usings.Add("Microsoft.EntityFrameworkCore");
usings.Add("IRaCIS.Core.Domain.Models");
}
if (!string.IsNullOrEmpty(NamespaceHint))
@ -62,12 +63,15 @@ namespace <#= NamespaceHint #>;
}
}
#>
public partial class <#= EntityType.Name #>
public partial class <#= EntityType.Name #>: BaseFullAuditEntity
{
<#
var firstProperty = true;
var excludedColumns = new[] { "CreateUserId", "Id", "UpdateUserId", "CreateTime", "UpdateTime", "DeleteUserId", "IsDeleted", "DeletedTime" };
foreach (var property in EntityType.GetProperties().OrderBy(p => p.GetColumnOrder() ?? -1))
{
if (!excludedColumns.Contains(property.Name))
{
if (!firstProperty)
{
WriteLine("");
@ -100,6 +104,7 @@ public partial class <#= EntityType.Name #>
public <#= code.Reference(property.ClrType) #><#= needsNullable ? "?" : "" #> <#= property.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #>
<#
firstProperty = false;
}
}
foreach (var navigation in EntityType.GetNavigations())