From b079a7d390964e8a467a10e173f08ab11f69ec69 Mon Sep 17 00:00:00 2001 From: Falcon <12919280+falconfly@user.noreply.gitee.com> Date: Tue, 3 Dec 2024 17:36:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E4=B8=BB=E9=94=AE=E5=A2=9E=E5=8A=A0Ke?= =?UTF-8?q?yAttribute=E7=89=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Falcon.SugarApi/DatabaseDefinitions/EntityGuidId.cs | 2 ++ Falcon.SugarApi/DatabaseDefinitions/EntityIntId.cs | 2 ++ Falcon.SugarApi/DatabaseDefinitions/EntityStringId.cs | 1 + 3 files changed, 5 insertions(+) diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityGuidId.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityGuidId.cs index 798e075..a1eb595 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/EntityGuidId.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/EntityGuidId.cs @@ -1,5 +1,6 @@ using SqlSugar; using System; +using System.ComponentModel.DataAnnotations; namespace Falcon.SugarApi.DatabaseDefinitions { @@ -10,6 +11,7 @@ namespace Falcon.SugarApi.DatabaseDefinitions /// /// 主键 /// + [Key] [SugarColumn(IsPrimaryKey = true,ColumnDescription = "主键")] public Guid? Id { get; set; } = Guid.NewGuid(); } diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityIntId.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityIntId.cs index 903ae4d..ebabd57 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/EntityIntId.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/EntityIntId.cs @@ -1,4 +1,5 @@ using SqlSugar; +using System.ComponentModel.DataAnnotations; namespace Falcon.SugarApi.DatabaseDefinitions { @@ -10,6 +11,7 @@ namespace Falcon.SugarApi.DatabaseDefinitions /// /// 主键 默认GUID 382c74c3-721d-4f34-80e5-57657b6cbc27 /// + [Key] [SugarColumn(IsPrimaryKey = true,ColumnDescription = "主键")] public int? Id { get; set; } } diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityStringId.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityStringId.cs index dea66b7..444cfab 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/EntityStringId.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/EntityStringId.cs @@ -12,6 +12,7 @@ namespace Falcon.SugarApi.DatabaseDefinitions /// 主键 默认GUID 382c74c3-721d-4f34-80e5-57657b6cbc27 /// [SugarColumn(IsPrimaryKey = true,ColumnDescription = "主键")] + [Key] [MaxLength(36)] public string? Id { get; set; } }