/// <summary> /// getSqlTrans: 得到SqlTrans对象 /// </summary> /// <returns>SqlTrans对象</returns> public static SqlTrans getSqlTrans() { SqlTrans _trans = null; if (helper == null) { helper = new MsSqlDBHelper(); } if (api == null) { api = new BaseApi(helper); } if (transAry.Count < 5) { _trans = new SqlTrans(api); transAry.Add(_trans); } else { for (int i = 0; i < transAry.Count; i++) { _trans = (SqlTrans)transAry[i]; if (_trans == null) { transAry.Remove(i); continue; } if (_trans.state != ConnectionState.Closed) { break; } } if (_trans == null) { _trans = new SqlTrans(api); transAry.Add(_trans); } } return(_trans); }
public void setBaseApi(BaseApi _baseApi) { baseApi = _baseApi; sqlCon = _baseApi.getDBHelper().getDbConnecton(); initTrans(); }
public SqlTrans(BaseApi _baseApi) { setBaseApi(_baseApi); }
public static void setBaseApi(BaseApi _api) { api = _api; }