From 564477b728716ddfab8e18f1bd85c36eb6048b06 Mon Sep 17 00:00:00 2001 From: hang <87227557@qq.com> Date: Sun, 8 Sep 2024 17:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=98=E6=96=B9t4=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E9=80=82=E9=85=8D=E6=88=91=E4=BB=AC=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 b/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 index 260898361..83ce23cca 100644 --- a/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 +++ b/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 @@ -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())