Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class MySqlDbConnection
- {
- private const string DbServer = "localhost";
- private const string DbName = "dbName";
- private const string DbUser = "dbUser";
- private const string DbPass = "dbPass";
- private static readonly string ConnectionString;
- static MySqlDbConnection()
- {
- ConnectionString = new MySqlConnectionStringBuilder
- {
- Server = DbServer,
- Database = DbName,
- UserID = DbUser,
- Password = DbPass,
- AllowBatch = true,
- AllowUserVariables = true,
- AllowZeroDateTime = true,
- ConvertZeroDateTime = true
- }.ConnectionString;
- }
- public static DbConnection Get() => new MySqlConnection(ConnectionString);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement