@@ -125,6 +125,8 @@ public ConnectionSettings(MySqlConnectionStringBuilder csb)
125125 UseXaTransactions = csb . UseXaTransactions ;
126126 }
127127
128+ public ConnectionSettings CloneWith ( string host , int port , string userId , bool isRedirected ) => new ConnectionSettings ( this , host , port , userId , isRedirected ) ;
129+
128130 private static MySqlGuidFormat GetEffectiveGuidFormat ( MySqlGuidFormat guidFormat , bool oldGuids )
129131 {
130132 switch ( guidFormat )
@@ -210,6 +212,7 @@ private static MySqlGuidFormat GetEffectiveGuidFormat(MySqlGuidFormat guidFormat
210212 public bool UseXaTransactions { get ; }
211213
212214 public byte [ ] ? ConnectionAttributes { get ; set ; }
215+ public bool IsRedirected { get ; }
213216
214217 // Helper Functions
215218 int ? m_connectionTimeoutMilliseconds ;
@@ -235,6 +238,66 @@ public int ConnectionTimeoutMilliseconds
235238 }
236239 }
237240
241+ private ConnectionSettings ( ConnectionSettings other , string host , int port , string userId , bool isRedirected )
242+ {
243+ ConnectionStringBuilder = other . ConnectionStringBuilder ;
244+ ConnectionString = other . ConnectionString ;
245+
246+ ConnectionProtocol = MySqlConnectionProtocol . Sockets ;
247+ HostNames = new [ ] { host } ;
248+ LoadBalance = other . LoadBalance ;
249+ Port = port ;
250+ PipeName = other . PipeName ;
251+
252+ UserID = userId ;
253+ Password = other . Password ;
254+ Database = other . Database ;
255+
256+ SslMode = other . SslMode ;
257+ CertificateFile = other . CertificateFile ;
258+ CertificatePassword = other . CertificatePassword ;
259+ SslCertificateFile = other . SslCertificateFile ;
260+ SslKeyFile = other . SslKeyFile ;
261+ CACertificateFile = other . CACertificateFile ;
262+ CertificateStoreLocation = other . CertificateStoreLocation ;
263+ CertificateThumbprint = other . CertificateThumbprint ;
264+
265+ Pooling = other . Pooling ;
266+ ConnectionLifeTime = other . ConnectionLifeTime ;
267+ ConnectionReset = other . ConnectionReset ;
268+ ConnectionIdlePingTime = other . ConnectionIdlePingTime ;
269+ ConnectionIdleTimeout = other . ConnectionIdleTimeout ;
270+ MinimumPoolSize = other . MinimumPoolSize ;
271+ MaximumPoolSize = other . MaximumPoolSize ;
272+
273+ AllowLoadLocalInfile = other . AllowLoadLocalInfile ;
274+ AllowPublicKeyRetrieval = other . AllowPublicKeyRetrieval ;
275+ AllowUserVariables = other . AllowUserVariables ;
276+ AllowZeroDateTime = other . AllowZeroDateTime ;
277+ ApplicationName = other . ApplicationName ;
278+ AutoEnlist = other . AutoEnlist ;
279+ ConnectionTimeout = other . ConnectionTimeout ;
280+ ConvertZeroDateTime = other . ConvertZeroDateTime ;
281+ DateTimeKind = other . DateTimeKind ;
282+ DefaultCommandTimeout = other . DefaultCommandTimeout ;
283+ ForceSynchronous = other . ForceSynchronous ;
284+ IgnoreCommandTransaction = other . IgnoreCommandTransaction ;
285+ IgnorePrepare = other . IgnorePrepare ;
286+ InteractiveSession = other . InteractiveSession ;
287+ GuidFormat = other . GuidFormat ;
288+ Keepalive = other . Keepalive ;
289+ NoBackslashEscapes = other . NoBackslashEscapes ;
290+ PersistSecurityInfo = other . PersistSecurityInfo ;
291+ ServerRsaPublicKeyFile = other . ServerRsaPublicKeyFile ;
292+ ServerSPN = other . ServerSPN ;
293+ TreatTinyAsBoolean = other . TreatTinyAsBoolean ;
294+ UseAffectedRows = other . UseAffectedRows ;
295+ UseCompression = other . UseCompression ;
296+ UseXaTransactions = other . UseXaTransactions ;
297+
298+ IsRedirected = isRedirected ;
299+ }
300+
238301 static readonly string [ ] s_localhostPipeServer = { "." } ;
239302 }
240303}
0 commit comments