MySQLConnection Conn.Connect() I'm pretty new to working with databases, and I would like to know if I've made some common, major design flaws in my implementation. For context, the whole project is intended to be used by a single user.

The code I want reviewed:

class DatabaseConnection
{
    //properties
    private MySqlConnection _connection;
    public MySqlConnection Connection { get { return _connection; } }
    public AccountLogin AccountCredentials { get; }
    public DatabaseLogin DatabaseCredentials { get; }

    //constructor
    public DatabaseConnection(AccountLogin _AccCred,
                              DatabaseLogin _DBCred)
    {
        AccountCredentials = _AccCred;
        DatabaseCredentials = _DBCred;
    }

    public void Connect()
    {
        if (Connection != null)
        {
            return;
        }

        string[] UserInputs =
        {
            DatabaseCredentials?.DatabaseName,
            DatabaseCredentials?.Server,
            DatabaseCredentials?.Port,
            AccountCredentials?.Password,
            AccountCredentials?.Username
        };
        bool ChkInpts = Validators.NullStringValidator(UserInputs);

        if (!ChkInpts)
        {
            string ConnInfo = "server=" + DatabaseCredentials.Server + ";" +
                              "user=" + AccountCredentials.Username + ";" +
                              "database=" + DatabaseCredentials.DatabaseName +
                              "port=" + DatabaseCredentials.Port + 
                              "password=" + AccountCredentials.Password;
            _connection = new MySqlConnection(ConnInfo);

            try
            {
                Console.WriteLine("Connecting to " + DatabaseCredentials.DatabaseName + "...");
                _connection.Open();
                Console.WriteLine("Connection to " + DatabaseCredentials.DatabaseName + " successful.");
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
    public void Close()
    {
        _connection.Close();
    }
}


Relevant code:

class AccountLogin
{
    public string Username { get; }
    public string Password { get; }

    public AccountLogin(string _username, string _password)
    {
        Username = _username;
        Password = _password;
    }
}

class DatabaseLogin
{
    public string DatabaseName { get; }
    public string Server { get; }
    public string Port { get; }

    public DatabaseLogin(string _server, string _DatabaseName, string _port)
    {
        DatabaseName = _DatabaseName;
        Server = _server;
        Port = _port;
    }
}

static class Validators
{
    public static bool NullStringValidator(string[] _inputs)
    {
        bool _result = false;
        for (int i = 0; i &lt; _inputs.Length; i++)
        {
            if (string.IsNullOrEmpty(_inputs[i]))
            {
                return _result = true;
            }
        }
        return _result;
    }
}
The conventional naming for arguments in C# is camelCase:


  AccountLogin _AccCred


looks better as

AccountLogin accountLogin




I wonder if this: DatabaseCredentials?.DatabaseName is of any use? if DatabaseCredentials is null what database can you then connect to?

I would throw an exception if DatabaseCredentials == null. This applies probably to AccountCredentials too.



String concatenations are a rather inefficient way to  build strings:

instead of 

string ConnInfo = "server=" + DatabaseCredentials.Server + ";" +
                              "user=" + AccountCredentials.Username + ";" +
                              "database=" + DatabaseCredentials.DatabaseName +
                              "port=" + DatabaseCredentials.Port + 
                              "password=" + AccountCredentials.Password;


use either 

StringBuilder


or

String.Format("server={0};user={1};...", DatabaseCredentials.Server, AccountCredentials.Username,...);


or

string interpolation:

$"server={DatabaseCredentials.Server};user={AccountCredentials.Username};..."




MySqlConnection implements IDisposable. Therefore your wrapper should do that as well, so you can dispose the _connection object, and the client can then use your wrapper like this:

using (DatabaseConnection dc = new DatabaseConnection(...))
{
  // Use the connection...
}




The try-catch-statement in the Connect() method is of no use to the client because, if the connection fails, it is not signaled to the client. Either rethrow the exception, throw a new exception of your own or simply ignore any exceptions here and let the client handle them.



in

public void Close()
{
    _connection.Close();
}


you should test for _connection == null.