Esempio n. 1
0
 /// <summary>
 /// 根据数据库类型获取适配器
 /// </summary>
 /// <param name="dbContext"></param>
 /// <returns></returns>
 public static DBAdapterBase GetDBAdapterBase(DbContext dbContext)
 {
     DBAdapterBase db = null;
     switch (dbContext.DBHelper.CurrentDBType)
     {
         case CoreHelper.DBType.MSSQL:
             db = new MSSQLDBAdapter(dbContext);
             break;
         case CoreHelper.DBType.MSSQL2000:
             db = new MSSQL2000DBAdapter(dbContext);
             break;
         case CoreHelper.DBType.ACCESS:
             break;
         case CoreHelper.DBType.MYSQL:
             db = new MySQLDBAdapter(dbContext);
             break;
         case CoreHelper.DBType.ORACLE:
             db = new ORACLEDBAdapter(dbContext);
             break;
     }
     if (db == null)
     {
         throw new Exception("找不到对应的DBAdapte" + dbContext.DBHelper.CurrentDBType);
     }
     return db;
 }
Esempio n. 2
0
        /// <summary>
        /// 根据数据库类型获取适配器
        /// </summary>
        /// <param name="dbContext"></param>
        /// <returns></returns>
        public static DBAdapterBase GetDBAdapterBase(DbContext dbContext)
        {
            DBAdapterBase db = null;

            switch (dbContext.DBHelper.CurrentDBType)
            {
            case CoreHelper.DBType.MSSQL:
                db = new MSSQLDBAdapter(dbContext);
                break;

            case CoreHelper.DBType.MSSQL2000:
                db = new MSSQL2000DBAdapter(dbContext);
                break;

            case CoreHelper.DBType.ACCESS:
                break;

            case CoreHelper.DBType.MYSQL:
                db = new MySQLDBAdapter(dbContext);
                break;

            case CoreHelper.DBType.ORACLE:
                db = new ORACLEDBAdapter(dbContext);
                break;

            case CoreHelper.DBType.MongoDB:
                db = new MongoDBAdapter(dbContext);
                break;
            }
            if (db == null)
            {
                throw new CRLException("找不到对应的DBAdapte" + dbContext.DBHelper.CurrentDBType);
            }
            return(db);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据数据库类型获取适配器
        /// </summary>
        /// <param name="dbType"></param>
        /// <returns></returns>
        public static DBAdapterBase GetDBAdapterBase(CoreHelper.DBType dbType)
        {
            DBAdapterBase db = null;

            switch (dbType)
            {
            case CoreHelper.DBType.MSSQL:
                db = new MSSQLDBAdapter();
                break;

            case CoreHelper.DBType.MSSQL2000:
                db = new MSSQL2000DBAdapter();
                break;

            case CoreHelper.DBType.ACCESS:
                break;

            case CoreHelper.DBType.MYSQL:
                db = new MySQLDBAdapter();
                break;

            case CoreHelper.DBType.ORACLE:
                db = new ORACLEDBAdapter();
                break;
            }
            if (db == null)
            {
                throw new Exception("找不到对应的DBAdapte" + dbType);
            }
            return(db);
        }