Skip to content

Commit ae20c81

Browse files
committed
Small corrections-adjustements.
1 parent 7d49521 commit ae20c81

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

src/MongoDB.Bson/IO/BsonWriterSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
using System;
17-
using MongoDB.Bson.Serialization;
1817

1918
namespace MongoDB.Bson.IO
2019
{

src/MongoDB.Bson/Serialization/BsonDeserializationContext.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ private BsonDeserializationContext(
4646

4747
_serializationDomain = serializationDomain; //FP Using this version to find error in an easier way for now
4848
//_serializationDomain = serializationDomain ?? BsonSerializer.DefaultSerializationDomain;
49-
50-
_dynamicArraySerializer ??= _serializationDomain.BsonDefaults.DynamicArraySerializer;
51-
_dynamicDocumentSerializer ??= _serializationDomain.BsonDefaults.DynamicDocumentSerializer;
5249
}
5350

5451
// public properties
@@ -177,10 +174,11 @@ internal Builder(BsonDeserializationContext other, IBsonReader reader, IBsonSeri
177174
_dynamicArraySerializer = other.DynamicArraySerializer;
178175
_dynamicDocumentSerializer = other.DynamicDocumentSerializer;
179176
}
180-
181-
/* QUESTION I removed the part where we set the dynamic serializers from the BsonDefaults, and delay it until we have a serialization domain (when we build the DeserializationContext).
182-
* This is technically changing the public behaviour, but it's in a builder, I do not thing it will affect anyone. Same done for the serialization context.
183-
*/
177+
else
178+
{
179+
_dynamicArraySerializer = serializationDomain.BsonDefaults.DynamicArraySerializer;
180+
_dynamicDocumentSerializer = serializationDomain.BsonDefaults.DynamicDocumentSerializer;
181+
}
184182
}
185183

186184
// properties

src/MongoDB.Bson/Serialization/BsonSerializationInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public BsonValue SerializeValue(object value)
155155
var tempDocument = new BsonDocument();
156156
using (var bsonWriter = new BsonDocumentWriter(tempDocument))
157157
{
158-
//QUESTION Is it correct we only need a default domain here?
158+
//QUESTION Is it correct we only need a standard domain here?
159159
var context = BsonSerializationContext.CreateRoot(bsonWriter, BsonSerializer.DefaultSerializationDomain);
160160
bsonWriter.WriteStartDocument();
161161
bsonWriter.WriteName("value");
@@ -175,7 +175,7 @@ public BsonArray SerializeValues(IEnumerable values)
175175
var tempDocument = new BsonDocument();
176176
using (var bsonWriter = new BsonDocumentWriter(tempDocument))
177177
{
178-
//QUESTION Is it correct we only need a default domain here?
178+
//QUESTION Is it correct we only need a standard domain here?
179179
var context = BsonSerializationContext.CreateRoot(bsonWriter, BsonSerializer.DefaultSerializationDomain);
180180
bsonWriter.WriteStartDocument();
181181
bsonWriter.WriteName("values");

src/MongoDB.Bson/Serialization/BsonSerializer.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ public static bool UseZeroIdChecker
6464
internal static ReaderWriterLockSlim ConfigLock => _serializationDomain.ConfigLock;
6565

6666
// public static methods
67-
68-
/// <summary>
69-
/// //TODO
70-
/// </summary>
71-
/// <returns></returns>
67+
//FP TODO: This is used only for testing, it can be removed later.
7268
internal static IBsonSerializationDomain CreateSerializationDomain() => new BsonSerializationDomain();
7369

7470
/// <summary>

src/MongoDB.Bson/Serialization/IBsonSerializationDomain.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/* Copyright 2010-present MongoDB Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
116
using System;
217
using System.IO;
318
using System.Threading;

src/MongoDB.Bson/Serialization/Serializers/TupleSerializers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ public sealed class TupleSerializer<T1> : SealedClassSerializerBase<Tuple<T1>>,
109109
// private fields
110110
private readonly Lazy<IBsonSerializer<T1>> _lazyItem1Serializer;
111111

112+
//DOMAIN-API This should be removed in the future.
112113
// constructors
113114
/// <summary>
114115
/// Initializes a new instance of the <see cref="TupleSerializer{T1}"/> class.
115116
/// </summary>
116117
public TupleSerializer()
117-
: this(BsonSerializer.SerializerRegistry) //TODO We can keep this as is
118+
: this(BsonSerializer.SerializerRegistry)
118119
{
119120
}
120121

0 commit comments

Comments
 (0)