/// <summary> /// 重置状态 /// </summary> public virtual bool ResetState(int id) { using (MySqlDataBaseScope.CreateScope(DataBase)) { var sql = $@"UPDATE `{WriteTableName}` SET {ResetStateFileSqlCode} WHERE {PrimaryKeyConditionSQL}"; return(DataBase.Execute(sql, CreatePimaryKeyParameter(id)) == 1); } }
/// <summary> /// 重置状态 /// </summary> public virtual bool ResetState(Expression <Func <TData, bool> > lambda) { using (MySqlDataBaseScope.CreateScope(DataBase)) { var convert = Compile(lambda); var sql = $@"UPDATE `{WriteTableName}` SET {ResetStateFileSqlCode} WHERE {convert.ConditionSql}"; return(DataBase.Execute(sql, convert.Parameters) >= 1); } }
/// <summary> /// 构造 /// </summary> /// <param name="dataBase">数据库对象</param> private TransactionScope(MySqlDataBase dataBase) { dbScope = MySqlDataBaseScope.CreateScope(dataBase); _preScope = CurrentScope; CurrentScope = this; _dataBase = dataBase; dataBase.Open(); if (dataBase.Transaction != null) { return; } _beginType = 1; dataBase.Transaction = dataBase.Connection.BeginTransaction(); }
/// <summary> /// 生成数据库使用范围 /// </summary> /// <returns></returns> IDisposable IDataBase.CreateDataBaseScope() => MySqlDataBaseScope.CreateScope(this);