/// <summary> /// web.config에 설정된 디비 연결문에 맞는 디비 커넥션 객체를 넘겨준다. /// </summary> /// <param name="dnsName"></param> /// <returns>IDbConnection</returns> public virtual IDbConnection GetConnection(string dnsName) { try { string connectString = DBConfiguration.GetConnectionString(dnsName); if (dbType == DBType.MSSQL) { this.cn = new System.Data.SqlClient.SqlConnection(connectString); } //else if (dbType == DBType.OLEDB) // this.cn = new System.Data.OleDb.OleDbConnection(connectString); //else if (dbType == DBType.ODBC) // this.cn = new System.Data.Odbc.OdbcConnection(connectString); //else if (dbType == DBType.ORACLE) // this.cn = new System.Data.OracleClient.OracleConnection(connectString); else { this.cn = null; } Retry.RetryAction(() => { if (this.cn != null && this.cn.State != ConnectionState.Open) { this.cn.Open(); } }, 3, 0); return(this.cn); } catch (System.Exception ex) { throw ex; } }
public DaoBase(string dnsName) { dbType = DBConfiguration.GetDbType(dnsName); this.dnsName = dnsName; }
public DaoBase() { dbType = DBConfiguration.GetDbType(string.Empty); }