Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using MySql.Data.MySqlClient;
- namespace MediaProviderWorker.Helpers.Database
- {
- class MysqlConnectionData
- {
- public string Server { get { return _server; }set { _server = value; } }
- public string Port { get { return _port; }set { _port = value; } }
- public string Db { get { return _db; }set { _db = value; } }
- public string User { get { return _user; }set { _user = value; } }
- public string Password { get { return _password; }set { _password = value; } }
- public bool Pooling { get { return _pooling; }set { _pooling = value; } }
- string _server;
- string _port;
- string _db;
- string _user;
- string _password;
- bool _pooling;
- public MysqlConnectionData() { }
- public MysqlConnectionData(string server, string db, string user, string password = "", string port = "3306", bool pooling = false)
- {
- _server = server;
- _port = port;
- _db = db;
- _user = user;
- _password = password;
- _pooling = pooling;
- }
- public override string ToString()
- {
- return string.Format("Server={0};Port={1};Database={2};User ID={3};Password={4};Pooling={5}", _server, _port, _db, _user, _password, (_pooling ? "true" : "false"));
- }
- }
- class MysqlProvider
- {
- MySqlConnection dbcon = null;
- public MysqlProvider(MysqlConnectionData ConnectionData)
- {
- dbcon = new MySqlConnection(ConnectionData.ToString());
- dbcon.Open();
- }
- ~MysqlProvider()
- {
- dbcon.Close();
- dbcon = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement