From 41aa2bd3f1aa231d9287a6b0630ed902cab533f8 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 13 Sep 2022 15:26:23 +0800 Subject: [PATCH] Insertable.ExecuteCommandIdentityIntoEntity --- .../Abstract/InsertableProvider/InsertableProvider.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs index 8c6757d11..9e6ffbef8 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs @@ -244,7 +244,10 @@ namespace SqlSugar if (snowColumn!=null) { var id = this.ExecuteReturnSnowflakeId(); - snowColumn.PropertyInfo.SetValue(result, id); + if (Convert.ToInt64(snowColumn.PropertyInfo.GetValue(result)) == 0) + { + snowColumn.PropertyInfo.SetValue(result, id); + } return true; } else