@@ -48,7 +48,6 @@ public class MongoClientSettings : IEquatable<MongoClientSettings>, IInheritable
4848 private TimeSpan _connectTimeout ;
4949 private MongoCredential _credential ;
5050 private bool _directConnection ;
51- private IBsonSerializationDomain _domain ;
5251 private TimeSpan _heartbeatInterval ;
5352 private TimeSpan _heartbeatTimeout ;
5453 private bool _ipv6 ;
@@ -68,6 +67,7 @@ public class MongoClientSettings : IEquatable<MongoClientSettings>, IInheritable
6867 private bool _retryReads ;
6968 private bool _retryWrites ;
7069 private ConnectionStringScheme _scheme ;
70+ private IBsonSerializationDomain _serializationDomain ;
7171 private ServerApi _serverApi ;
7272 private List < MongoServerAddress > _servers ;
7373 private ServerMonitoringMode _serverMonitoringMode ;
@@ -101,7 +101,6 @@ public MongoClientSettings()
101101 _compressors = new CompressorConfiguration [ 0 ] ;
102102 _connectTimeout = MongoDefaults . ConnectTimeout ;
103103 _directConnection = false ;
104- _domain = null ;
105104 _heartbeatInterval = ServerSettings . DefaultHeartbeatInterval ;
106105 _heartbeatTimeout = ServerSettings . DefaultHeartbeatTimeout ;
107106 _ipv6 = false ;
@@ -120,6 +119,7 @@ public MongoClientSettings()
120119 _retryReads = true ;
121120 _retryWrites = true ;
122121 _scheme = ConnectionStringScheme . MongoDB ;
122+ _serializationDomain = BsonSerializer . DefaultDomain ;
123123 _serverApi = null ;
124124 _servers = new List < MongoServerAddress > { new MongoServerAddress ( "localhost" ) } ;
125125 _serverMonitoringMode = ServerMonitoringMode . Auto ;
@@ -267,23 +267,6 @@ public bool DirectConnection
267267 }
268268 }
269269
270- /// <summary>
271- /// //TODO
272- /// </summary>
273- /// <exception cref="InvalidOperationException"></exception>
274- public IBsonSerializationDomain Domain
275- {
276- get
277- {
278- return _domain ;
279- }
280- set
281- {
282- if ( _isFrozen ) { throw new InvalidOperationException ( "MongoClientSettings is frozen." ) ; }
283- _domain = value ;
284- }
285- }
286-
287270 /// <summary>
288271 /// Gets a value indicating whether the settings have been frozen to prevent further changes.
289272 /// </summary>
@@ -491,6 +474,21 @@ public ReadPreference ReadPreference
491474 }
492475 }
493476
477+ /// <summary>
478+ /// //TODO
479+ /// </summary>
480+ /// <exception cref="InvalidOperationException"></exception>
481+ /// <exception cref="ArgumentNullException"></exception>
482+ public IBsonSerializationDomain SerializationDomain
483+ {
484+ get => _serializationDomain ;
485+ set
486+ {
487+ if ( _isFrozen ) { throw new InvalidOperationException ( "MongoClientSettings is frozen." ) ; }
488+ _serializationDomain = value ?? throw new ArgumentNullException ( nameof ( value ) ) ;
489+ }
490+ }
491+
494492 /// <summary>
495493 /// Gets or sets the name of the replica set.
496494 /// </summary>
0 commit comments