Beispiel #1
0
        private static IDbAccess CreateMySql(string connStr)
        {
            MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connStr);
            IDbAccess iDb = new MySqlIDbAccess()
            {
                conn             = conn,
                ConnectionString = connStr,
                DataBaseType     = DataBaseType.MYSQL
            };

            return(iDb);
        }
Beispiel #2
0
        public static IDbAccess CreateIDb(string connStr, string dbType)
        {
            IDbAccess dbAccess = null;

            if (dbType == "oracle")
            {
                OracleConnection conn = new OracleConnection(connStr);
                dbAccess = new OracleIDbAccess()
                {
                    conn          = conn,
                    ConnectionStr = connStr,
                };
            }
            else if (dbType == "mysql")
            {
                MySqlConnection conn = new MySqlConnection(connStr);
                dbAccess = new MySqlIDbAccess()
                {
                    conn          = conn,
                    ConnectionStr = connStr,
                };
            }
            return(dbAccess);
        }