Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public static class MySqlDbConnection
  2. {
  3. private const string DbServer = "localhost";
  4. private const string DbName = "dbName";
  5. private const string DbUser = "dbUser";
  6. private const string DbPass = "dbPass";
  7. private static readonly string ConnectionString;
  8.  
  9. static MySqlDbConnection()
  10. {
  11. ConnectionString = new MySqlConnectionStringBuilder
  12. {
  13. Server = DbServer,
  14. Database = DbName,
  15. UserID = DbUser,
  16. Password = DbPass,
  17. AllowBatch = true,
  18. AllowUserVariables = true,
  19. AllowZeroDateTime = true,
  20. ConvertZeroDateTime = true
  21. }.ConnectionString;
  22. }
  23.  
  24. public static DbConnection Get() => new MySqlConnection(ConnectionString);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement