在创建架构提取公共方法时,发生了这个错误
public class BaseDal<T> where T:class { private readonly SqlSugarClient _db = SqlSugarFatory.GetInstance(); #region 插入方法 /// <summary> /// 插入并返回受影响行数用ExecuteCommand /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(T model) { //忽略该字段的插入 _db.IgnoreColumns.Add("id", "t_sys_user"); var result = _db.Insertable(model).ExecuteCommand(); return result; }
解决办法:原有是T的约束没有加new()
public class BaseDal<T> where T:class,new()