@@ -876,54 +876,54 @@ public override string ToString()
876
876
var query = new StringBuilder ( ) ;
877
877
if ( _authenticationMechanism != null )
878
878
{
879
- query . AppendFormat ( "authMechanism={0}; " , _authenticationMechanism ) ;
879
+ query . AppendFormat ( "authMechanism={0}& " , _authenticationMechanism ) ;
880
880
}
881
881
if ( _authenticationMechanismProperties . Any ( ) )
882
882
{
883
883
query . AppendFormat (
884
- "authMechanismProperties={0}; " ,
884
+ "authMechanismProperties={0}& " ,
885
885
string . Join ( "," , _authenticationMechanismProperties
886
886
. Select ( x => string . Format ( "{0}:{1}" , x . Key , x . Value ) ) . ToArray ( ) ) ) ;
887
887
}
888
888
if ( _authenticationSource != null )
889
889
{
890
- query . AppendFormat ( "authSource={0}; " , _authenticationSource ) ;
890
+ query . AppendFormat ( "authSource={0}& " , _authenticationSource ) ;
891
891
}
892
892
if ( _applicationName != null )
893
893
{
894
- query . AppendFormat ( "appname={0}; " , _applicationName ) ;
894
+ query . AppendFormat ( "appname={0}& " , _applicationName ) ;
895
895
}
896
896
if ( _ipv6 )
897
897
{
898
- query . AppendFormat ( "ipv6=true; " ) ;
898
+ query . AppendFormat ( "ipv6=true& " ) ;
899
899
}
900
900
if ( _scheme == ConnectionStringScheme . MongoDBPlusSrv )
901
901
{
902
902
if ( ! _useTls )
903
903
{
904
- query . AppendFormat ( "tls=false; " ) ;
904
+ query . AppendFormat ( "tls=false& " ) ;
905
905
}
906
906
}
907
907
else
908
908
{
909
909
if ( _useTls )
910
910
{
911
- query . AppendFormat ( "tls=true; " ) ;
911
+ query . AppendFormat ( "tls=true& " ) ;
912
912
}
913
913
}
914
914
if ( _allowInsecureTls )
915
915
{
916
- query . AppendFormat ( "tlsInsecure=true; " ) ;
916
+ query . AppendFormat ( "tlsInsecure=true& " ) ;
917
917
}
918
918
919
919
if ( _tlsDisableCertificateRevocationCheck != null )
920
920
{
921
- query . AppendFormat ( "tlsDisableCertificateRevocationCheck={0}; " , JsonConvert . ToString ( _tlsDisableCertificateRevocationCheck . Value ) ) ;
921
+ query . AppendFormat ( "tlsDisableCertificateRevocationCheck={0}& " , JsonConvert . ToString ( _tlsDisableCertificateRevocationCheck . Value ) ) ;
922
922
}
923
923
924
924
if ( _compressors ? . Any ( ) ?? false )
925
925
{
926
- query . AppendFormat ( "compressors={0}; " , string . Join ( "," , _compressors . Select ( x => x . Type . ToString ( ) . ToLowerInvariant ( ) ) ) ) ;
926
+ query . AppendFormat ( "compressors={0}& " , string . Join ( "," , _compressors . Select ( x => x . Type . ToString ( ) . ToLowerInvariant ( ) ) ) ) ;
927
927
foreach ( var compressor in _compressors )
928
928
{
929
929
ParseAndAppendCompressorOptions ( query , compressor ) ;
@@ -934,142 +934,142 @@ public override string ToString()
934
934
{
935
935
if ( _connectionMode != ConnectionMode . Automatic )
936
936
{
937
- query . AppendFormat ( "connect={0}; " , MongoUtils . ToCamelCase ( _connectionMode . ToString ( ) ) ) ;
937
+ query . AppendFormat ( "connect={0}& " , MongoUtils . ToCamelCase ( _connectionMode . ToString ( ) ) ) ;
938
938
}
939
939
}
940
940
else if ( _connectionModeSwitch == ConnectionModeSwitch . UseDirectConnection )
941
941
#pragma warning restore CS0618
942
942
{
943
943
if ( _directConnection . HasValue )
944
944
{
945
- query . AppendFormat ( "directConnection={0}; " , JsonConvert . ToString ( _directConnection . Value ) ) ;
945
+ query . AppendFormat ( "directConnection={0}& " , JsonConvert . ToString ( _directConnection . Value ) ) ;
946
946
}
947
947
}
948
948
if ( ! string . IsNullOrEmpty ( _replicaSetName ) )
949
949
{
950
- query . AppendFormat ( "replicaSet={0}; " , _replicaSetName ) ;
950
+ query . AppendFormat ( "replicaSet={0}& " , _replicaSetName ) ;
951
951
}
952
952
if ( _readConcernLevel != null )
953
953
{
954
- query . AppendFormat ( "readConcernLevel={0}; " , MongoUtils . ToCamelCase ( _readConcernLevel . Value . ToString ( ) ) ) ;
954
+ query . AppendFormat ( "readConcernLevel={0}& " , MongoUtils . ToCamelCase ( _readConcernLevel . Value . ToString ( ) ) ) ;
955
955
}
956
956
if ( _readPreference != null )
957
957
{
958
- query . AppendFormat ( "readPreference={0}; " , MongoUtils . ToCamelCase ( _readPreference . ReadPreferenceMode . ToString ( ) ) ) ;
958
+ query . AppendFormat ( "readPreference={0}& " , MongoUtils . ToCamelCase ( _readPreference . ReadPreferenceMode . ToString ( ) ) ) ;
959
959
if ( _readPreference . TagSets != null )
960
960
{
961
961
foreach ( var tagSet in _readPreference . TagSets )
962
962
{
963
- query . AppendFormat ( "readPreferenceTags={0}; " , string . Join ( "," , tagSet . Tags . Select ( t => string . Format ( "{0}:{1}" , t . Name , t . Value ) ) . ToArray ( ) ) ) ;
963
+ query . AppendFormat ( "readPreferenceTags={0}& " , string . Join ( "," , tagSet . Tags . Select ( t => string . Format ( "{0}:{1}" , t . Name , t . Value ) ) . ToArray ( ) ) ) ;
964
964
}
965
965
}
966
966
if ( _readPreference . MaxStaleness . HasValue )
967
967
{
968
- query . AppendFormat ( "maxStaleness={0}; " , FormatTimeSpan ( _readPreference . MaxStaleness . Value ) ) ;
968
+ query . AppendFormat ( "maxStaleness={0}& " , FormatTimeSpan ( _readPreference . MaxStaleness . Value ) ) ;
969
969
}
970
970
}
971
971
if ( _fsync != null )
972
972
{
973
- query . AppendFormat ( "fsync={0}; " , JsonConvert . ToString ( _fsync . Value ) ) ;
973
+ query . AppendFormat ( "fsync={0}& " , JsonConvert . ToString ( _fsync . Value ) ) ;
974
974
}
975
975
if ( _journal != null )
976
976
{
977
- query . AppendFormat ( "journal={0}; " , JsonConvert . ToString ( _journal . Value ) ) ;
977
+ query . AppendFormat ( "journal={0}& " , JsonConvert . ToString ( _journal . Value ) ) ;
978
978
}
979
979
if ( _w != null )
980
980
{
981
- query . AppendFormat ( "w={0}; " , _w ) ;
981
+ query . AppendFormat ( "w={0}& " , _w ) ;
982
982
}
983
983
if ( _wTimeout != null )
984
984
{
985
- query . AppendFormat ( "wtimeout={0}; " , FormatTimeSpan ( _wTimeout . Value ) ) ;
985
+ query . AppendFormat ( "wtimeout={0}& " , FormatTimeSpan ( _wTimeout . Value ) ) ;
986
986
}
987
987
if ( _connectTimeout != MongoDefaults . ConnectTimeout )
988
988
{
989
- query . AppendFormat ( "connectTimeout={0}; " , FormatTimeSpan ( _connectTimeout ) ) ;
989
+ query . AppendFormat ( "connectTimeout={0}& " , FormatTimeSpan ( _connectTimeout ) ) ;
990
990
}
991
991
if ( _heartbeatInterval != ServerSettings . DefaultHeartbeatInterval )
992
992
{
993
- query . AppendFormat ( "heartbeatInterval={0}; " , FormatTimeSpan ( _heartbeatInterval ) ) ;
993
+ query . AppendFormat ( "heartbeatInterval={0}& " , FormatTimeSpan ( _heartbeatInterval ) ) ;
994
994
}
995
995
if ( _heartbeatTimeout != ServerSettings . DefaultHeartbeatTimeout )
996
996
{
997
- query . AppendFormat ( "heartbeatTimeout={0}; " , FormatTimeSpan ( _heartbeatTimeout ) ) ;
997
+ query . AppendFormat ( "heartbeatTimeout={0}& " , FormatTimeSpan ( _heartbeatTimeout ) ) ;
998
998
}
999
999
if ( _loadBalanced )
1000
1000
{
1001
- query . AppendFormat ( "loadBalanced={0}; " , JsonConvert . ToString ( _loadBalanced ) ) ;
1001
+ query . AppendFormat ( "loadBalanced={0}& " , JsonConvert . ToString ( _loadBalanced ) ) ;
1002
1002
}
1003
1003
if ( _localThreshold != MongoDefaults . LocalThreshold )
1004
1004
{
1005
- query . AppendFormat ( "localThreshold={0}; " , FormatTimeSpan ( _localThreshold ) ) ;
1005
+ query . AppendFormat ( "localThreshold={0}& " , FormatTimeSpan ( _localThreshold ) ) ;
1006
1006
}
1007
1007
if ( _maxConnecting != MongoInternalDefaults . ConnectionPool . MaxConnecting )
1008
1008
{
1009
- query . AppendFormat ( "maxConnecting={0}; " , _maxConnecting ) ;
1009
+ query . AppendFormat ( "maxConnecting={0}& " , _maxConnecting ) ;
1010
1010
}
1011
1011
if ( _maxConnectionIdleTime != MongoDefaults . MaxConnectionIdleTime )
1012
1012
{
1013
- query . AppendFormat ( "maxIdleTime={0}; " , FormatTimeSpan ( _maxConnectionIdleTime ) ) ;
1013
+ query . AppendFormat ( "maxIdleTime={0}& " , FormatTimeSpan ( _maxConnectionIdleTime ) ) ;
1014
1014
}
1015
1015
if ( _maxConnectionLifeTime != MongoDefaults . MaxConnectionLifeTime )
1016
1016
{
1017
- query . AppendFormat ( "maxLifeTime={0}; " , FormatTimeSpan ( _maxConnectionLifeTime ) ) ;
1017
+ query . AppendFormat ( "maxLifeTime={0}& " , FormatTimeSpan ( _maxConnectionLifeTime ) ) ;
1018
1018
}
1019
1019
if ( _maxConnectionPoolSize != MongoDefaults . MaxConnectionPoolSize )
1020
1020
{
1021
- query . AppendFormat ( "maxPoolSize={0}; " , _maxConnectionPoolSize ) ;
1021
+ query . AppendFormat ( "maxPoolSize={0}& " , _maxConnectionPoolSize ) ;
1022
1022
}
1023
1023
if ( _minConnectionPoolSize != MongoDefaults . MinConnectionPoolSize )
1024
1024
{
1025
- query . AppendFormat ( "minPoolSize={0}; " , _minConnectionPoolSize ) ;
1025
+ query . AppendFormat ( "minPoolSize={0}& " , _minConnectionPoolSize ) ;
1026
1026
}
1027
1027
if ( _serverSelectionTimeout != MongoDefaults . ServerSelectionTimeout )
1028
1028
{
1029
- query . AppendFormat ( "serverSelectionTimeout={0}; " , FormatTimeSpan ( _serverSelectionTimeout ) ) ;
1029
+ query . AppendFormat ( "serverSelectionTimeout={0}& " , FormatTimeSpan ( _serverSelectionTimeout ) ) ;
1030
1030
}
1031
1031
if ( _socketTimeout != MongoDefaults . SocketTimeout )
1032
1032
{
1033
- query . AppendFormat ( "socketTimeout={0}; " , FormatTimeSpan ( _socketTimeout ) ) ;
1033
+ query . AppendFormat ( "socketTimeout={0}& " , FormatTimeSpan ( _socketTimeout ) ) ;
1034
1034
}
1035
1035
#pragma warning disable 618
1036
1036
if ( _waitQueueMultiple != 0.0 && _waitQueueMultiple != MongoDefaults . WaitQueueMultiple )
1037
1037
#pragma warning restore 618
1038
1038
{
1039
- query . AppendFormat ( "waitQueueMultiple={0}; " , _waitQueueMultiple ) ;
1039
+ query . AppendFormat ( "waitQueueMultiple={0}& " , _waitQueueMultiple ) ;
1040
1040
}
1041
1041
#pragma warning disable 618
1042
1042
if ( _waitQueueSize != 0 && _waitQueueSize != MongoDefaults . WaitQueueSize )
1043
1043
#pragma warning restore 618
1044
1044
{
1045
- query . AppendFormat ( "waitQueueSize={0}; " , _waitQueueSize ) ;
1045
+ query . AppendFormat ( "waitQueueSize={0}& " , _waitQueueSize ) ;
1046
1046
}
1047
1047
if ( _waitQueueTimeout != MongoDefaults . WaitQueueTimeout )
1048
1048
{
1049
- query . AppendFormat ( "waitQueueTimeout={0}; " , FormatTimeSpan ( WaitQueueTimeout ) ) ;
1049
+ query . AppendFormat ( "waitQueueTimeout={0}& " , FormatTimeSpan ( WaitQueueTimeout ) ) ;
1050
1050
}
1051
1051
#pragma warning disable 618
1052
1052
var defaultGuidRepresentation = BsonDefaults . GuidRepresentationMode == GuidRepresentationMode . V2 ? BsonDefaults . GuidRepresentation : GuidRepresentation . Unspecified ;
1053
1053
if ( _guidRepresentation != defaultGuidRepresentation )
1054
1054
{
1055
- query . AppendFormat ( "uuidRepresentation={0}; " , ( _guidRepresentation == GuidRepresentation . CSharpLegacy ) ? "csharpLegacy" : MongoUtils . ToCamelCase ( _guidRepresentation . ToString ( ) ) ) ;
1055
+ query . AppendFormat ( "uuidRepresentation={0}& " , ( _guidRepresentation == GuidRepresentation . CSharpLegacy ) ? "csharpLegacy" : MongoUtils . ToCamelCase ( _guidRepresentation . ToString ( ) ) ) ;
1056
1056
}
1057
1057
#pragma warning restore 618
1058
1058
if ( ! _retryReads . GetValueOrDefault ( true ) )
1059
1059
{
1060
- query . AppendFormat ( "retryReads=false; " ) ;
1060
+ query . AppendFormat ( "retryReads=false& " ) ;
1061
1061
}
1062
1062
if ( _retryWrites . HasValue )
1063
1063
{
1064
- query . AppendFormat ( "retryWrites={0}; " , JsonConvert . ToString ( _retryWrites . Value ) ) ;
1064
+ query . AppendFormat ( "retryWrites={0}& " , JsonConvert . ToString ( _retryWrites . Value ) ) ;
1065
1065
}
1066
1066
if ( _srvMaxHosts . HasValue )
1067
1067
{
1068
- query . AppendFormat ( "srvMaxHosts={0}; " , _srvMaxHosts ) ;
1068
+ query . AppendFormat ( "srvMaxHosts={0}& " , _srvMaxHosts ) ;
1069
1069
}
1070
1070
if ( query . Length != 0 )
1071
1071
{
1072
- query . Length = query . Length - 1 ; // remove trailing "; "
1072
+ query . Length = query . Length - 1 ; // remove trailing "& "
1073
1073
if ( _databaseName == null )
1074
1074
{
1075
1075
url . Append ( "/" ) ;
@@ -1228,7 +1228,7 @@ private static void ParseAndAppendCompressorOptions(StringBuilder builder, Compr
1228
1228
{
1229
1229
if ( compressorConfiguration . Properties . TryGetValue ( "Level" , out var zlibCompressionLevel ) )
1230
1230
{
1231
- builder . AppendFormat ( "zlibCompressionLevel={0}; " , zlibCompressionLevel ) ;
1231
+ builder . AppendFormat ( "zlibCompressionLevel={0}& " , zlibCompressionLevel ) ;
1232
1232
}
1233
1233
}
1234
1234
break ;
0 commit comments