From 851c245bb305a1d648c76020057c920f961e3c5d Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 26 Dec 2022 14:04:39 +0800 Subject: [PATCH] add error check --- Src/Asp.Net/SqlSugar/SqlSugarClient.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs index 78be4ce86..716788bd1 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs +++ b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs @@ -181,6 +181,10 @@ namespace SqlSugar public IInsertable Insertable(T insertObj) where T : class, new() { Check.Exception(typeof(T).FullName.Contains("System.Collections.Generic.List`"), " need where T: class, new() "); + if (typeof(T).Name == "Object") + { + Check.ExceptionEasy("Object type use db.InsertableByObject(obj).ExecuteCommand()", "检测到T为Object类型,请使用 db.InsertableByObject(obj).ExecuteCommand(),Insertable不支持object,InsertableByObject可以不过功能比较少"); + } return this.Context.Insertable(insertObj); }