2
2
using System . ComponentModel ;
3
3
using System . Diagnostics . CodeAnalysis ;
4
4
using System . Globalization ;
5
+ using System . Linq ;
5
6
using System . Text . RegularExpressions ;
6
7
using MySqlConnector . Utilities ;
7
8
@@ -787,6 +788,11 @@ public bool UseXaTransactions
787
788
788
789
// Other Methods
789
790
791
+ /// <summary>
792
+ /// Returns an <see cref="ICollection"/> that contains the keys in the <see cref="MySqlConnectionStringBuilder"/>.
793
+ /// </summary>
794
+ public override ICollection Keys => base . Keys . Cast < string > ( ) . OrderBy ( x => MySqlConnectionStringOption . OptionNames . IndexOf ( x ) ) . ToList ( ) ;
795
+
790
796
/// <summary>
791
797
/// Whether this <see cref="MySqlConnectionStringBuilder"/> contains a set option with the specified name.
792
798
/// </summary>
@@ -876,6 +882,8 @@ protected override void GetProperties(Hashtable propertyDescriptors)
876
882
877
883
internal abstract class MySqlConnectionStringOption
878
884
{
885
+ public static List < string > OptionNames { get ; } = new ( ) ;
886
+
879
887
// Connection Options
880
888
public static readonly MySqlConnectionStringReferenceOption < string > Server ;
881
889
public static readonly MySqlConnectionStringValueOption < uint > Port ;
@@ -892,9 +900,9 @@ internal abstract class MySqlConnectionStringOption
892
900
public static readonly MySqlConnectionStringReferenceOption < string > CertificatePassword ;
893
901
public static readonly MySqlConnectionStringValueOption < MySqlCertificateStoreLocation > CertificateStoreLocation ;
894
902
public static readonly MySqlConnectionStringReferenceOption < string > CertificateThumbprint ;
895
- public static readonly MySqlConnectionStringReferenceOption < string > SslCa ;
896
903
public static readonly MySqlConnectionStringReferenceOption < string > SslCert ;
897
904
public static readonly MySqlConnectionStringReferenceOption < string > SslKey ;
905
+ public static readonly MySqlConnectionStringReferenceOption < string > SslCa ;
898
906
public static readonly MySqlConnectionStringReferenceOption < string > TlsVersion ;
899
907
public static readonly MySqlConnectionStringReferenceOption < string > TlsCipherSuites ;
900
908
@@ -960,6 +968,7 @@ private static void AddOption(MySqlConnectionStringOption option)
960
968
{
961
969
foreach ( string key in option . m_keys )
962
970
s_options . Add ( key , option ) ;
971
+ OptionNames . Add ( option . m_keys [ 0 ] ) ;
963
972
}
964
973
965
974
#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations
@@ -1014,8 +1023,12 @@ static MySqlConnectionStringOption()
1014
1023
keys : new [ ] { "Certificate Password" , "CertificatePassword" } ,
1015
1024
defaultValue : "" ) ) ;
1016
1025
1017
- AddOption ( SslCa = new (
1018
- keys : new [ ] { "SSL CA" , "CACertificateFile" , "CA Certificate File" , "SslCa" , "Ssl-Ca" } ,
1026
+ AddOption ( CertificateStoreLocation = new (
1027
+ keys : new [ ] { "Certificate Store Location" , "CertificateStoreLocation" } ,
1028
+ defaultValue : MySqlCertificateStoreLocation . None ) ) ;
1029
+
1030
+ AddOption ( CertificateThumbprint = new (
1031
+ keys : new [ ] { "Certificate Thumbprint" , "CertificateThumbprint" , "Certificate Thumb Print" } ,
1019
1032
defaultValue : "" ) ) ;
1020
1033
1021
1034
AddOption ( SslCert = new (
@@ -1026,12 +1039,8 @@ static MySqlConnectionStringOption()
1026
1039
keys : new [ ] { "SSL Key" , "SslKey" , "Ssl-Key" } ,
1027
1040
defaultValue : "" ) ) ;
1028
1041
1029
- AddOption ( CertificateStoreLocation = new (
1030
- keys : new [ ] { "Certificate Store Location" , "CertificateStoreLocation" } ,
1031
- defaultValue : MySqlCertificateStoreLocation . None ) ) ;
1032
-
1033
- AddOption ( CertificateThumbprint = new (
1034
- keys : new [ ] { "Certificate Thumbprint" , "CertificateThumbprint" , "Certificate Thumb Print" } ,
1042
+ AddOption ( SslCa = new (
1043
+ keys : new [ ] { "SSL CA" , "CACertificateFile" , "CA Certificate File" , "SslCa" , "Ssl-Ca" } ,
1035
1044
defaultValue : "" ) ) ;
1036
1045
1037
1046
AddOption ( TlsVersion = new (
0 commit comments