public bool Initialize(string connString, ConnectionType type = ConnectionType.MYSQL) { connectionString = connString; connSettings = new ConnectorSettings(type); querySettings = new QuerySettings(type); if (type == ConnectionType.MYSQL) { db = new MySqlDatabase(this); } else if (type == ConnectionType.MSSQL) { db = new MSSqlDatabase(this); } var isOpen = false; try { using (var connection = CreateConnection()) isOpen = connection.State == ConnectionState.Open; } catch { return(false); } return(isOpen); }
public bool Initialize(string connString, ConnectionType type = ConnectionType.MYSQL) { connectionString = connString; connSettings = new ConnectorSettings(type); querySettings = new QuerySettings(type); if (type == ConnectionType.MYSQL) db = new MySqlDatabase(this); else if (type == ConnectionType.MSSQL) db = new MSSqlDatabase(this); var isOpen = false; try { using (var connection = CreateConnection()) isOpen = connection.State == ConnectionState.Open; } catch { return false; } return isOpen; }