From 743d14c8aa29d8869b4e505742fbfe59bce4a62c Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 28 Jun 2023 13:35:27 +0800 Subject: [PATCH] Modify verification --- .../Abstract/InsertableProvider/InsertableHelper.cs | 7 +++++-- Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableHelper.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableHelper.cs index 21b77b1fb..6152fc7e3 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableHelper.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableHelper.cs @@ -335,8 +335,11 @@ namespace SqlSugar else { return this.EntityInfo.Columns.Where(it => { - - Check.Exception(it.IsIdentity && it.UnderType == typeof(string), "IsIdentity key can not be type of string"); + + if (StaticConfig.Check_StringIdentity) + { + Check.ExceptionEasy(it.IsIdentity && it.UnderType == typeof(string), "Auto-incremented is not a string, how can I use a executable startup configuration: StaticConfig.Check_StringIdentity=false ", "自增不是能string,如何非要用可以程序启动配置:StaticConfig.Check_StringIdentity=false"); + } return it.IsIdentity; }).Select(it => it.DbColumnName).ToList(); diff --git a/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs b/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs index 42d698877..1946695ed 100644 --- a/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs +++ b/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs @@ -21,5 +21,7 @@ namespace SqlSugar public static Action CompleteDbFunc; public static Func> SplitTableGetTablesFunc; + + public static bool Check_StringIdentity = true; } }