基于.net sql server的连接池管理(支持事务管理)类库
基于.net sql server的连接池管理(支持事务管理)类库 轻松实现事务, 示例: public SqlTransaction Transaction { get { return this._transaction; } set { this._transaction = value; userdal.Transaction = value; //支持多个Dao的事务 groupdal.Transcation=value; } } SqlTransaction stran = this.dal.BeginTransaction(); try { this.Transaction = stran; foreach (var user in listUser) { this.Update(user ); groupdal.Add(group); } this.dal.Commit(); } catch (Exception) { this.dal.Rollback(); throw; } finally { this.Transaction = null; } (var user in listUser) { this.Update(user ); groupdal.Add(group); } this.dal.Commit(); } catch (Exception) { this.dal.Rollback(); throw; } finally { this.Transaction = null; }
用户评论