mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 05:13:27 +08:00
add error check
This commit is contained in:
parent
cc95ce1837
commit
851c245bb3
@ -181,6 +181,10 @@ namespace SqlSugar
|
|||||||
public IInsertable<T> Insertable<T>(T insertObj) where T : class, new()
|
public IInsertable<T> Insertable<T>(T insertObj) where T : class, new()
|
||||||
{
|
{
|
||||||
Check.Exception(typeof(T).FullName.Contains("System.Collections.Generic.List`"), " need 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<T>(insertObj);
|
return this.Context.Insertable<T>(insertObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user