/// <summary> /// 新增用户 /// </summary> /// <param name="model">用户实体</param> /// <returns></returns> public int Insert(BK_Users model) { var s = 0; model.User_id = null; //启用事务 var result = Sugar.db.Ado.UseTran(() => { //执行不插入User_id列(数据库ID自增长) UserDB.AsInsertable(model).IgnoreColumns(it => it == "User_id").ExecuteReturnIdentity(); }); if (result.IsSuccess) { s = 1; } else { Console.WriteLine(result.ErrorMessage); } return(s); }