From 63b0afd0df508da8306ec73c15f843f6000db431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Mon, 6 Nov 2023 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E4=BD=93=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=A8=A1=E5=9D=97=E6=97=B6=EF=BC=8C=E7=A8=8D=E5=BE=AE?= =?UTF-8?q?=E7=AD=89=E4=B8=80=E4=B8=8B=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=88=90=E5=8A=9F=EF=BC=8C=E8=80=8C=E5=8F=88=E8=A7=84?= =?UTF-8?q?=E9=81=BF=E4=BA=86=E5=8F=AF=E8=83=BD=E7=9A=84=E6=AD=BB=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XCode/Entity/Entity.cs | 2 +- XCode/Entity/IEntityModule.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/XCode/Entity/Entity.cs b/XCode/Entity/Entity.cs index abf654683..ee8470a55 100644 --- a/XCode/Entity/Entity.cs +++ b/XCode/Entity/Entity.cs @@ -383,7 +383,7 @@ private Task DoAction(Func> func, Boolean? isnew) private Boolean enableValid = true; /// 验证并修补数据,通过抛出异常的方式提示验证失败。 - /// 建议重写者调用基类的实现,因为基类自动填充雪花Id并验证字符串字段是否超长。 + /// 建议重写者调用基类的实现,因为基类自动生成雪花Id、填充创建更新信息以及验证字符串字段是否超长。 /// 是否新数据 public override void Valid(Boolean isNew) { diff --git a/XCode/Entity/IEntityModule.cs b/XCode/Entity/IEntityModule.cs index 6d2065839..465348e2f 100644 --- a/XCode/Entity/IEntityModule.cs +++ b/XCode/Entity/IEntityModule.cs @@ -59,7 +59,9 @@ public class EntityModules : IEnumerable public virtual void Add(IEntityModule module) { // 异步添加实体模块,避免死锁。实体类一般在静态构造函数里面添加模块,如果这里同步初始化会非常危险 - ThreadPool.UnsafeQueueUserWorkItem(s => AddAsync(s as IEntityModule), module); + //ThreadPool.UnsafeQueueUserWorkItem(s => AddAsync(s as IEntityModule), module); + var task = Task.Run(() => AddAsync(module)); + task.Wait(1_000); } /// 添加实体模块