|
16 | 16 | using System; |
17 | 17 | using System.Collections.Generic; |
18 | 18 | using System.Linq; |
19 | | -using MongoDB.Driver.Core.Clusters; |
20 | 19 | using MongoDB.Driver.Core.Configuration; |
21 | 20 | using MongoDB.Driver.Core.Servers; |
22 | 21 | using MongoDB.Shared; |
23 | 22 |
|
24 | 23 | namespace MongoDB.Driver |
25 | 24 | { |
26 | | - internal class ClusterKey |
| 25 | + internal sealed class ClusterKey |
27 | 26 | { |
28 | 27 | // fields |
29 | 28 | private readonly bool _allowInsecureTls; |
30 | 29 | private readonly string _applicationName; |
31 | 30 | private readonly Action<ClusterBuilder> _clusterConfigurator; |
32 | 31 | private readonly IReadOnlyList<CompressorConfiguration> _compressors; |
33 | | -#pragma warning disable CS0618 // Type or member is obsolete |
34 | | - private readonly ConnectionMode _connectionMode; |
35 | | - private readonly ConnectionModeSwitch _connectionModeSwitch; |
36 | | -#pragma warning restore CS0618 // Type or member is obsolete |
37 | 32 | private readonly TimeSpan _connectTimeout; |
38 | 33 | private readonly MongoCredential _credential; |
39 | 34 | private readonly CryptClientSettings _cryptClientSettings; |
40 | | - private readonly bool? _directConnection; |
| 35 | + private readonly bool _directConnection; |
41 | 36 | private readonly int _hashCode; |
42 | 37 | private readonly TimeSpan _heartbeatInterval; |
43 | 38 | private readonly TimeSpan _heartbeatTimeout; |
@@ -73,14 +68,10 @@ public ClusterKey( |
73 | 68 | string applicationName, |
74 | 69 | Action<ClusterBuilder> clusterConfigurator, |
75 | 70 | IReadOnlyList<CompressorConfiguration> compressors, |
76 | | -#pragma warning disable CS0618 // Type or member is obsolete |
77 | | - ConnectionMode connectionMode, |
78 | | - ConnectionModeSwitch connectionModeSwitch, |
79 | | -#pragma warning restore CS0618 // Type or member is obsolete |
80 | 71 | TimeSpan connectTimeout, |
81 | 72 | MongoCredential credential, |
82 | 73 | CryptClientSettings cryptClientSettings, |
83 | | - bool? directConnection, |
| 74 | + bool directConnection, |
84 | 75 | TimeSpan heartbeatInterval, |
85 | 76 | TimeSpan heartbeatTimeout, |
86 | 77 | bool ipv6, |
@@ -109,14 +100,10 @@ public ClusterKey( |
109 | 100 | int waitQueueSize, |
110 | 101 | TimeSpan waitQueueTimeout) |
111 | 102 | { |
112 | | - ConnectionModeHelper.EnsureConnectionModeValuesAreValid(connectionMode, connectionModeSwitch, directConnection); |
113 | | - |
114 | 103 | _allowInsecureTls = allowInsecureTls; |
115 | 104 | _applicationName = applicationName; |
116 | 105 | _clusterConfigurator = clusterConfigurator; |
117 | 106 | _compressors = compressors; |
118 | | - _connectionMode = connectionMode; |
119 | | - _connectionModeSwitch = connectionModeSwitch; |
120 | 107 | _connectTimeout = connectTimeout; |
121 | 108 | _credential = credential; |
122 | 109 | _cryptClientSettings = cryptClientSettings; |
@@ -157,36 +144,10 @@ public ClusterKey( |
157 | 144 | public string ApplicationName { get { return _applicationName; } } |
158 | 145 | public Action<ClusterBuilder> ClusterConfigurator { get { return _clusterConfigurator; } } |
159 | 146 | public IReadOnlyList<CompressorConfiguration> Compressors { get { return _compressors; } } |
160 | | - [Obsolete("Use DirectConnection instead.")] |
161 | | - public ConnectionMode ConnectionMode |
162 | | - { |
163 | | - get |
164 | | - { |
165 | | - if (_connectionModeSwitch == ConnectionModeSwitch.UseDirectConnection) |
166 | | - { |
167 | | - throw new InvalidOperationException("ConnectionMode cannot be used when ConnectionModeSwitch is set to UseDirectConnection."); |
168 | | - } |
169 | | - return _connectionMode; |
170 | | - } |
171 | | - } |
172 | | - [Obsolete("This property will be removed in a later release.")] |
173 | | - public ConnectionModeSwitch ConnectionModeSwitch => _connectionModeSwitch; |
174 | 147 | public TimeSpan ConnectTimeout { get { return _connectTimeout; } } |
175 | 148 | public MongoCredential Credential { get { return _credential; } } |
176 | 149 | public CryptClientSettings CryptClientSettings { get { return _cryptClientSettings; } } |
177 | | - public bool? DirectConnection |
178 | | - { |
179 | | - get |
180 | | - { |
181 | | -#pragma warning disable CS0618 // Type or member is obsolete |
182 | | - if (_connectionModeSwitch == ConnectionModeSwitch.UseConnectionMode) |
183 | | -#pragma warning restore CS0618 // Type or member is obsolete |
184 | | - { |
185 | | - throw new InvalidOperationException("DirectConnection cannot be used when ConnectionModeSwitch is set to UseConnectionMode."); |
186 | | - } |
187 | | - return _directConnection; |
188 | | - } |
189 | | - } |
| 150 | + public bool DirectConnection { get { return _directConnection; } } |
190 | 151 | public TimeSpan HeartbeatInterval { get { return _heartbeatInterval; } } |
191 | 152 | public TimeSpan HeartbeatTimeout { get { return _heartbeatTimeout; } } |
192 | 153 | public bool IPv6 { get { return _ipv6; } } |
@@ -238,8 +199,6 @@ public override bool Equals(object obj) |
238 | 199 | _applicationName == rhs._applicationName && |
239 | 200 | object.ReferenceEquals(_clusterConfigurator, rhs._clusterConfigurator) && |
240 | 201 | _compressors.SequenceEqual(rhs._compressors) && |
241 | | - _connectionMode == rhs._connectionMode && |
242 | | - _connectionModeSwitch == rhs._connectionModeSwitch && |
243 | 202 | _connectTimeout == rhs._connectTimeout && |
244 | 203 | _credential == rhs._credential && |
245 | 204 | object.Equals(_cryptClientSettings, rhs._cryptClientSettings) && |
|
0 commit comments