-
Notifications
You must be signed in to change notification settings - Fork 350
Closed
Labels
Description
Add a new method, MySqlConnection.CloneWith(string connectionString) that returns an unopened copy of an existing connection, but with a new connection string. If the new connection string doesn't supply a password, the current connection's password is used.
This would allow (for example) pooling to be changed without disclosing the existing connection's password or requiring the calling code to know it.
Examples:
var newCsb = new MySqlConnectionConnectionStringBuilder(existingConnection.ConnectionString)
{
Database = "",
Pooling = false,
};
var newConnection = existingConnection.CloneWith(csb.ConnectionString);From PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#908 (comment) and similar to https://github.com/npgsql/npgsql/blob/7c44dd30144c224995e688d526276f5373c93de7/src/Npgsql/NpgsqlConnection.cs#L1297-L1315.