@@ -45,22 +45,25 @@ public sealed class MongoClient : IMongoClient
45
45
private readonly IOperationExecutor _operationExecutor ;
46
46
private readonly MongoClientSettings _settings ;
47
47
private readonly ILogger < LogCategories . Client > _logger ;
48
+ private readonly IBsonSerializerRegistry _serializerRegistry ;
48
49
49
50
// constructors
50
51
/// <summary>
51
52
/// Initializes a new instance of the MongoClient class.
52
53
/// </summary>
53
- public MongoClient ( )
54
- : this ( new MongoClientSettings ( ) )
54
+ public MongoClient ( IBsonSerializerRegistry serializerRegistry = null )
55
+ : this ( new MongoClientSettings ( ) , serializerRegistry )
55
56
{
56
57
}
57
58
58
59
/// <summary>
59
60
/// Initializes a new instance of the MongoClient class.
60
61
/// </summary>
61
62
/// <param name="settings">The settings.</param>
62
- public MongoClient ( MongoClientSettings settings )
63
+ /// <param name="serializerRegistry"></param> //TODO
64
+ public MongoClient ( MongoClientSettings settings , IBsonSerializerRegistry serializerRegistry = null )
63
65
{
66
+ _serializerRegistry = serializerRegistry ?? BsonSerializer . SerializerRegistry ;
64
67
_settings = Ensure . IsNotNull ( settings , nameof ( settings ) ) . FrozenCopy ( ) ;
65
68
_logger = _settings . LoggingSettings ? . CreateLogger < LogCategories . Client > ( ) ;
66
69
@@ -83,21 +86,23 @@ public MongoClient(MongoClientSettings settings)
83
86
/// Initializes a new instance of the MongoClient class.
84
87
/// </summary>
85
88
/// <param name="url">The URL.</param>
86
- public MongoClient ( MongoUrl url )
87
- : this ( MongoClientSettings . FromUrl ( url ) )
89
+ /// <param name="serializerRegistry"></param> //TODO
90
+ public MongoClient ( MongoUrl url , IBsonSerializerRegistry serializerRegistry = null )
91
+ : this ( MongoClientSettings . FromUrl ( url ) , serializerRegistry )
88
92
{
89
93
}
90
94
91
95
/// <summary>
92
96
/// Initializes a new instance of the MongoClient class.
93
97
/// </summary>
94
98
/// <param name="connectionString">The connection string.</param>
95
- public MongoClient ( string connectionString )
99
+ /// <param name="serializerRegistry"></param> //TODO
100
+ public MongoClient ( string connectionString , IBsonSerializerRegistry serializerRegistry = null )
96
101
: this ( MongoClientSettings . FromConnectionString ( connectionString ) )
97
102
{
98
103
}
99
104
100
- internal MongoClient ( IOperationExecutor operationExecutor , MongoClientSettings settings )
105
+ internal MongoClient ( IOperationExecutor operationExecutor , MongoClientSettings settings ) //TODO Do we need to add it here too..?
101
106
: this ( settings )
102
107
{
103
108
_operationExecutor = operationExecutor ;
0 commit comments