/// <summary> /// 根据要修改字段参数(参数名和参数值)、过滤条件Sql、过滤字段参数(参数名和参数值)修改数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="updateParam">要修改字段参数(参数名和参数值),例:new {Uname="joyet",Age = 110}</param> /// <param name="whereSql">过滤条件Sql</param> /// <param name="whereParam">过滤字段参数(参数名和参数值),例:new {UserId=1}</param> /// <returns></returns> public virtual int Update <T>(object updateParam, string whereSql, object whereParam) { int result = 0; var dbEntity = DbBuilder.Update <T>(updateParam, whereSql, whereParam); if (dbEntity == null) { return(result); } result = DbHelper.ExecuteNonQuery(dbEntity.CommandText, dbEntity.DbParams); HandelExecuteDbCallBack(dbEntity.CommandText, dbEntity.DbParams); return(result); }
/// <summary> /// 根据实体主键值修改其它字段数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <returns></returns> public virtual int Update <T>(T entity) { int result = 0; var dbEntity = DbBuilder.Update <T>(entity); if (dbEntity == null) { return(result); } result = DbHelper.ExecuteNonQuery(dbEntity.CommandText, dbEntity.DbParams); HandelExecuteDbCallBack(dbEntity.CommandText, dbEntity.DbParams); return(result); }