Esempio n. 1
0
        /// <summary>
        /// 单件模式返回SqlServerDB实例
        /// </summary>
        /// <param name="connectStr">链接字符串<remarks>确保sqlserver链接字符串中database=master</remarks></param>
        /// <param name="databaseName">数据库名</param>
        /// <param name="dBType">数据库类型</param>
        /// <returns>SqlServerDB 实例</returns>
        public static SqlServerDB GetInstance()
        {
            System.Threading.Monitor.Enter(lockObj);
            if (instance == null)
                instance = new SqlServerDB();
            System.Threading.Monitor.Exit(lockObj);

            return instance;
        }
Esempio n. 2
0
        /// <summary>
        /// 单件模式返回SqlServerDB实例
        /// </summary>
        /// <param name="connectStr">链接字符串<remarks>确保sqlserver链接字符串中database=master</remarks></param>
        /// <param name="databaseName">数据库名</param>
        /// <param name="dBType">数据库类型</param>
        /// <returns>SqlServerDB 实例</returns>
        public static SqlServerDB GetInstance()
        {
            System.Threading.Monitor.Enter(lockObj);
            if (instance == null)
            {
                instance = new SqlServerDB();
            }
            System.Threading.Monitor.Exit(lockObj);

            return(instance);
        }