Skip to content

Commit f83e98f

Browse files
committed
feat(orm): 为实体字符串属性添加 MaxLength 验证特性
为 CreatedName、UpdatedName、DeletedName、Name 属性添加 [MaxLength(512)] 为 Description 属性添加 [MaxLength(4096)]
1 parent ece10f8 commit f83e98f

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

GameFrameX.Foundation.Orm.Entity/EntityBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// ==========================================================================================
3333

3434
using System.ComponentModel;
35+
using System.ComponentModel.DataAnnotations;
3536
using GameFrameX.Foundation.Orm.Entity.Filter;
3637

3738
namespace GameFrameX.Foundation.Orm.Entity;
@@ -72,6 +73,7 @@ public abstract class EntityBase : EntityBaseId, ISafeDeletedFilter, IVersionedE
7273
/// </remarks>
7374
/// <value>创建人姓名 / Creator name</value>
7475
[Description("创建人姓名")]
76+
[MaxLength(512)]
7577
public virtual string? CreatedName { get; set; }
7678

7779
/// <summary>
@@ -112,6 +114,7 @@ public abstract class EntityBase : EntityBaseId, ISafeDeletedFilter, IVersionedE
112114
/// </remarks>
113115
/// <value>更新人姓名 / Updater name</value>
114116
[Description("更新人姓名")]
117+
[MaxLength(512)]
115118
public virtual string? UpdatedName { get; set; }
116119

117120
/// <summary>
@@ -152,6 +155,7 @@ public abstract class EntityBase : EntityBaseId, ISafeDeletedFilter, IVersionedE
152155
/// </remarks>
153156
/// <value>删除人姓名 / Deleter name</value>
154157
[Description("删除人姓名")]
158+
[MaxLength(512)]
155159
public virtual string? DeletedName { get; set; }
156160

157161
/// <summary>
@@ -213,6 +217,7 @@ public abstract class EntityBase<TKey> : EntityBaseId<TKey>, ISafeDeletedFilter,
213217
/// </remarks>
214218
/// <value>创建人姓名 / Creator name</value>
215219
[Description("创建人姓名")]
220+
[MaxLength(512)]
216221
public virtual string? CreatedName { get; set; }
217222

218223
/// <summary>
@@ -253,6 +258,7 @@ public abstract class EntityBase<TKey> : EntityBaseId<TKey>, ISafeDeletedFilter,
253258
/// </remarks>
254259
/// <value>更新人姓名 / Updater name</value>
255260
[Description("更新人姓名")]
261+
[MaxLength(512)]
256262
public virtual string? UpdatedName { get; set; }
257263

258264
/// <summary>
@@ -293,6 +299,7 @@ public abstract class EntityBase<TKey> : EntityBaseId<TKey>, ISafeDeletedFilter,
293299
/// </remarks>
294300
/// <value>删除人姓名 / Deleter name</value>
295301
[Description("删除人姓名")]
302+
[MaxLength(512)]
296303
public virtual string? DeletedName { get; set; }
297304

298305
/// <summary>
@@ -314,4 +321,4 @@ public abstract class EntityBase<TKey> : EntityBaseId<TKey>, ISafeDeletedFilter,
314321
/// <value><c>true</c> 表示启用;<c>false</c> 表示禁用;<c>null</c> 表示未设置(启用) / <c>true</c> for enabled; <c>false</c> for disabled; <c>null</c> for unset (enabled)</value>
315322
[Description("是否启用,true:启用,false:禁用,null:未设置(启用)")]
316323
public virtual bool? IsEnabled { get; set; }
317-
}
324+
}

GameFrameX.Foundation.Orm.Entity/EntitySelectBase.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// ==========================================================================================
3333

3434
using GameFrameX.Foundation.Orm.Entity.Filter;
35+
using System.ComponentModel.DataAnnotations;
3536

3637
namespace GameFrameX.Foundation.Orm.Entity;
3738

@@ -51,6 +52,7 @@ public abstract class EntitySelectBase : EntityBase, ISelectFilter
5152
/// </remarks>
5253
/// <value>名称 / Name</value>
5354
[System.ComponentModel.Description("名称")]
55+
[MaxLength(512)]
5456
public virtual string? Name { get; set; }
5557

5658
/// <summary>
@@ -61,6 +63,7 @@ public abstract class EntitySelectBase : EntityBase, ISelectFilter
6163
/// </remarks>
6264
/// <value>详细描述 / Detailed description</value>
6365
[System.ComponentModel.Description("详细描述")]
66+
[MaxLength(4096)]
6467
public virtual string? Description { get; set; }
6568
}
6669

@@ -82,6 +85,7 @@ public abstract class EntitySelectBase<TKey> : EntityBase<TKey>, ISelectFilter
8285
/// </remarks>
8386
/// <value>名称 / Name</value>
8487
[System.ComponentModel.Description("名称")]
88+
[MaxLength(512)]
8589
public virtual string? Name { get; set; }
8690

8791
/// <summary>
@@ -92,5 +96,6 @@ public abstract class EntitySelectBase<TKey> : EntityBase<TKey>, ISelectFilter
9296
/// </remarks>
9397
/// <value>详细描述 / Detailed description</value>
9498
[System.ComponentModel.Description("详细描述")]
99+
[MaxLength(4096)]
95100
public virtual string? Description { get; set; }
96-
}
101+
}

0 commit comments

Comments
 (0)