コード例 #1
0
        // =====================================================
        public static MySqlDbConnection getInstance(string uid = null, string password = null)
        // =====================================================
        {
            if (_dbConnection == null)
            {
                Console.WriteLine("Using the MySql database.");
                _dbConnection = new MySqlDbConnection(uid, password);
            }

            return((MySqlDbConnection)_dbConnection);
        }
コード例 #2
0
        // =====================================================
        public static DbConnection getInstance(string uid = null, string password = null)
        // =====================================================
        {
            if (_dbConnection == null)
            {
                if (Server == DbConnection.Server.MySql)
                {
                    _dbConnection = MySqlDbConnection.getInstance();
                }
                else if (Server == DbConnection.Server.MongoDb)
                {
                    _dbConnection = MongoDbConnection.getInstance();
                }
                else
                {
                    throw new HammerMainException("Error: DB Server unavailable.");
                }
            }

            return(_dbConnection);
        }