Ejemplo n.º 1
0
        /// <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;
            }
        }
Ejemplo n.º 2
0
 public DaoBase(string dnsName)
 {
     dbType       = DBConfiguration.GetDbType(dnsName);
     this.dnsName = dnsName;
 }
Ejemplo n.º 3
0
 public DaoBase()
 {
     dbType = DBConfiguration.GetDbType(string.Empty);
 }