Exemple #1
0
 /// <summary>
 /// 根据配置获取数据访问
 /// </summary>
 /// <param name="config"></param>
 /// <returns></returns>
 public static DataAccessBroker Instance(DataAccessConfiguration config)
 {
     DataAccessBroker _broker = null;
     if (string.Compare(config.DBType, DBTYPE_SQLSERVER, false) == 0)
     {
         _broker = new SQLDataAccessBroker();
         _broker.Configuration = config;
     }
     else
     {
         _broker = new OracelDataAccessBroker();
         _broker.Configuration = config;
     }
     _broker.Create();//创建并打开数据库连接
     return _broker;
 }
        /// <summary>
        /// 根据配置获取数据访问
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static DataAccessBroker Instance(DataAccessConfiguration config)
        {
            DataAccessBroker _broker = null;

            if (string.Compare(config.DBType, "ORACLE", false) == 0)
            {
                _broker = new SQLDataAccessBroker();
                _broker.Configuration = config;
            }
            else if (string.Compare(config.DBType, "SQLServer", false) == 0)
            {
                _broker = new SQLServerDataAccessBroker();
                _broker.Configuration = config;
            }
            _broker.Create();//创建并打开数据库连接
            return(_broker);
        }
Exemple #3
0
        /// <summary>
        /// 根据配置获取数据访问
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static DataAccessBroker Instance(DataAccessConfiguration config)
        {
            DataAccessBroker _broker = null;

            if (string.Compare(config.DBType, DBTYPE_SQLSERVER, false) == 0)
            {
                _broker = new SQLDataAccessBroker();
                _broker.Configuration = config;
            }
            //else if (string.Compare(config.DBType, DBTYPE_ODBC, false) == 0)
            //{
            //    _broker = new ODBCDataAccessBroker();
            //    _broker.Configuration = config;
            //}
            else
            {
                _broker = new OracelDataAccessBroker();
                _broker.Configuration = config;
            }
            _broker.Create();//创建并打开数据库连接
            return(_broker);
        }