Class ConnectionString
- Namespace
- MongoDB.Driver.Core.Configuration
- Assembly
- MongoDB.Driver.Core.dll
Represents a connection string.
public sealed class ConnectionString
- Inheritance
-
ConnectionString
- Inherited Members
Constructors
ConnectionString(string)
Initializes a new instance of the ConnectionString class.
public ConnectionString(string connectionString)
Parameters
connectionString
stringThe connection string.
Properties
AllOptionNames
Gets all the option names.
public IEnumerable<string> AllOptionNames { get; }
Property Value
AllUnknownOptionNames
Gets all the unknown option names.
public IEnumerable<string> AllUnknownOptionNames { get; }
Property Value
ApplicationName
Gets the application name.
public string ApplicationName { get; }
Property Value
AuthMechanism
Gets the auth mechanism.
public string AuthMechanism { get; }
Property Value
AuthMechanismProperties
Gets the auth mechanism properties.
public IReadOnlyDictionary<string, string> AuthMechanismProperties { get; }
Property Value
AuthSource
Gets the auth source.
public string AuthSource { get; }
Property Value
Compressors
Gets the requested compressors.
public IReadOnlyList<CompressorConfiguration> Compressors { get; }
Property Value
Connect
Gets the connection mode.
[Obsolete("Use DirectConnection instead.")]
public ClusterConnectionMode Connect { get; }
Property Value
ConnectTimeout
Gets the connect timeout.
public TimeSpan? ConnectTimeout { get; }
Property Value
ConnectionModeSwitch
Gets the connection mode switch.
[Obsolete("This property will be removed in a later release.")]
public ConnectionModeSwitch ConnectionModeSwitch { get; }
Property Value
DatabaseName
Gets the name of the database.
public string DatabaseName { get; }
Property Value
DirectConnection
Gets the directConnection.
public bool? DirectConnection { get; }
Property Value
- bool?
FSync
Gets the fsync value of the write concern.
public bool? FSync { get; }
Property Value
- bool?
HeartbeatInterval
Gets the heartbeat interval.
public TimeSpan? HeartbeatInterval { get; }
Property Value
HeartbeatTimeout
Gets the heartbeat timeout.
public TimeSpan? HeartbeatTimeout { get; }
Property Value
Hosts
Gets the hosts.
public IReadOnlyList<EndPoint> Hosts { get; }
Property Value
Ipv6
Gets whether to use IPv6.
public bool? Ipv6 { get; }
Property Value
- bool?
IsResolved
Gets whether the connection string has been resolved. Always true when scheme is MongoDB.
public bool IsResolved { get; }
Property Value
Journal
Gets the journal value of the write concern.
public bool? Journal { get; }
Property Value
- bool?
LoadBalanced
Gets a value indicating whether load balanced mode is used.
public bool LoadBalanced { get; }
Property Value
LocalThreshold
Gets the local threshold.
public TimeSpan? LocalThreshold { get; }
Property Value
MaxConnecting
Gets the maximum number of connections a pool may be establishing concurrently. Defaults to 2.
public int? MaxConnecting { get; }
Property Value
- int?
MaxIdleTime
Gets the max idle time.
public TimeSpan? MaxIdleTime { get; }
Property Value
MaxLifeTime
Gets the max life time.
public TimeSpan? MaxLifeTime { get; }
Property Value
MaxPoolSize
Gets the max size of the connection pool.
public int? MaxPoolSize { get; }
Property Value
- int?
MaxStaleness
Gets the max staleness.
public TimeSpan? MaxStaleness { get; }
Property Value
MinPoolSize
Gets the min size of the connection pool.
public int? MinPoolSize { get; }
Property Value
- int?
Password
Gets the password.
public string Password { get; }
Property Value
ReadConcernLevel
Gets the read concern level.
public ReadConcernLevel? ReadConcernLevel { get; }
Property Value
- ReadConcernLevel?
The read concern level.
ReadPreference
Gets the read preference.
public ReadPreferenceMode? ReadPreference { get; }
Property Value
ReadPreferenceTags
Gets the read preference tags.
public IReadOnlyList<TagSet> ReadPreferenceTags { get; }
Property Value
ReplicaSet
Gets the replica set name.
public string ReplicaSet { get; }
Property Value
RetryReads
Gets a value indicating whether or not to retry reads.
public bool? RetryReads { get; }
Property Value
- bool?
RetryWrites
Gets a value indicating whether or not to retry writes.
public bool? RetryWrites { get; }
Property Value
- bool?
Scheme
Gets the connection string scheme.
public ConnectionStringScheme Scheme { get; }
Property Value
ServerSelectionTimeout
Gets the server selection timeout.
public TimeSpan? ServerSelectionTimeout { get; }
Property Value
SocketTimeout
Gets the socket timeout.
public TimeSpan? SocketTimeout { get; }
Property Value
SrvMaxHosts
Limits the number of SRV records used to populate the seedlist during initial discovery, as well as the number of additional hosts that may be added during SRV polling.
public int? SrvMaxHosts { get; }
Property Value
- int?
Ssl
Gets whether to use SSL.
[Obsolete("Use Tls instead.")]
public bool? Ssl { get; }
Property Value
- bool?
SslVerifyCertificate
Gets whether to verify SSL certificates.
[Obsolete("Use TlsInsecure instead.")]
public bool? SslVerifyCertificate { get; }
Property Value
- bool?
Tls
Gets whether to use TLS.
public bool? Tls { get; }
Property Value
- bool?
TlsDisableCertificateRevocationCheck
Get whether or not certificate revocation checking is disabled during the TLS handshake.
public bool? TlsDisableCertificateRevocationCheck { get; }
Property Value
- bool?
TlsInsecure
Gets whether to relax TLS constraints as much as possible.
public bool? TlsInsecure { get; }
Property Value
- bool?
Username
Gets the username.
public string Username { get; }
Property Value
UuidRepresentation
Gets the UUID representation.
public GuidRepresentation? UuidRepresentation { get; }
Property Value
W
Gets the w value of the write concern.
public WriteConcern.WValue W { get; }
Property Value
WTimeout
Gets the wtimeout value of the write concern.
public TimeSpan? WTimeout { get; }
Property Value
WaitQueueMultiple
Gets the wait queue multiple.
[Obsolete("This property will be removed in a later release.")]
public double? WaitQueueMultiple { get; }
Property Value
WaitQueueSize
Gets the wait queue size.
[Obsolete("This property will be removed in a later release.")]
public int? WaitQueueSize { get; }
Property Value
- int?
WaitQueueTimeout
Gets the wait queue timeout.
public TimeSpan? WaitQueueTimeout { get; }
Property Value
Methods
GetOption(string)
Gets the option.
public string GetOption(string name)
Parameters
name
stringThe name.
Returns
- string
The option with the specified name.
Resolve(bool, CancellationToken)
Resolves a connection string. If the connection string indicates more information is available in the DNS system, it will acquire that information as well.
public ConnectionString Resolve(bool resolveHosts, CancellationToken cancellationToken = default)
Parameters
resolveHosts
boolWhether to resolve hosts.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- ConnectionString
A resolved ConnectionString.
Resolve(CancellationToken)
Resolves a connection string. If the connection string indicates more information is available in the DNS system, it will acquire that information as well.
public ConnectionString Resolve(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- ConnectionString
A resolved ConnectionString.
ResolveAsync(bool, CancellationToken)
Resolves a connection string. If the connection string indicates more information is available in the DNS system, it will acquire that information as well.
public Task<ConnectionString> ResolveAsync(bool resolveHosts, CancellationToken cancellationToken = default)
Parameters
resolveHosts
boolWhether to resolve hosts.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ConnectionString>
A resolved ConnectionString.
ResolveAsync(CancellationToken)
Resolves a connection string. If the connection string indicates more information is available in the DNS system, it will acquire that information as well.
public Task<ConnectionString> ResolveAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ConnectionString>
A resolved ConnectionString.
ToString()
public override string ToString()