Skip to content

Commit 0ae768c

Browse files
committed
Finished comments in the Bson lib
1 parent 3ad811e commit 0ae768c

10 files changed

+20
-21
lines changed

src/MongoDB.Bson/BsonDefaults.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static IBsonSerializer DynamicArraySerializer
4242
{
4343
if (!__dynamicArraySerializerWasSet)
4444
{
45-
__dynamicArraySerializer = BsonSerializer.LookupSerializer<List<object>>(); //TODO I think we could keep this as is
45+
__dynamicArraySerializer = BsonSerializer.LookupSerializer<List<object>>(); //TODO ??
4646
}
4747
return __dynamicArraySerializer;
4848
}
@@ -62,7 +62,7 @@ public static IBsonSerializer DynamicDocumentSerializer
6262
{
6363
if (!__dynamicDocumentSerializerWasSet)
6464
{
65-
__dynamicDocumentSerializer = BsonSerializer.LookupSerializer<ExpandoObject>(); //TODO I think we could keep this as is
65+
__dynamicDocumentSerializer = BsonSerializer.LookupSerializer<ExpandoObject>(); //TODO ??
6666
}
6767
return __dynamicDocumentSerializer;
6868
}

src/MongoDB.Bson/BsonExtensionMethods.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static byte[] ToBson(
8484

8585
if (serializer == null)
8686
{
87-
serializer = BsonSerializer.LookupSerializer(nominalType); //TODO I think we need another method with the domain as input
87+
serializer = BsonSerializer.LookupSerializer(nominalType); //TODO ??
8888
}
8989
if (serializer.ValueType != nominalType)
9090
{
@@ -165,7 +165,7 @@ public static BsonDocument ToBsonDocument(
165165
return convertibleToBsonDocument.ToBsonDocument(); // use the provided ToBsonDocument method
166166
}
167167

168-
serializer = BsonSerializer.LookupSerializer(nominalType); //TODO I think we need another method with the domain as input
168+
serializer = BsonSerializer.LookupSerializer(nominalType); //TODO ??
169169
}
170170
if (serializer.ValueType != nominalType)
171171
{
@@ -236,7 +236,7 @@ public static string ToJson(
236236

237237
if (serializer == null)
238238
{
239-
serializer = BsonSerializer.LookupSerializer(nominalType); //TODO I think we need another method with the domain as input
239+
serializer = BsonSerializer.LookupSerializer(nominalType); //TODO ??
240240
}
241241
if (serializer.ValueType != nominalType)
242242
{

src/MongoDB.Bson/ObjectModel/BsonDocumentWrapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static BsonDocumentWrapper Create<TNominalType>(TNominalType value)
104104
/// <returns>A BsonDocumentWrapper.</returns>
105105
public static BsonDocumentWrapper Create(Type nominalType, object value)
106106
{
107-
var serializer = BsonSerializer.LookupSerializer(nominalType); //TODO I think this could stay. We can potentially add methods with the domain as input.
107+
var serializer = BsonSerializer.LookupSerializer(nominalType); //TODO ??
108108
return new BsonDocumentWrapper(value, serializer);
109109
}
110110

@@ -121,7 +121,7 @@ public static IEnumerable<BsonDocumentWrapper> CreateMultiple<TNominalType>(IEnu
121121
throw new ArgumentNullException("values");
122122
}
123123

124-
var serializer = BsonSerializer.LookupSerializer(typeof(TNominalType)); //TODO I think this could stay. We can potentially add methods with the domain as input.
124+
var serializer = BsonSerializer.LookupSerializer(typeof(TNominalType)); //TODO ??
125125
return values.Select(v => new BsonDocumentWrapper(v, serializer));
126126
}
127127

@@ -142,7 +142,7 @@ public static IEnumerable<BsonDocumentWrapper> CreateMultiple(Type nominalType,
142142
throw new ArgumentNullException("values");
143143
}
144144

145-
var serializer = BsonSerializer.LookupSerializer(nominalType); //TODO I think this could stay. We can potentially add methods with the domain as input.
145+
var serializer = BsonSerializer.LookupSerializer(nominalType); //TODO ??
146146
return values.Cast<object>().Select(v => new BsonDocumentWrapper(v, serializer));
147147
}
148148

src/MongoDB.Bson/Serialization/BsonMemberMap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public IBsonSerializer GetSerializer()
301301
// return special serializer for BsonValue members that handles the _csharpnull representation
302302
if (_memberTypeIsBsonValue)
303303
{
304-
var wrappedSerializer = BsonSerializer.LookupSerializer(_memberType); //TODO We need another version of this with the domain as input
304+
var wrappedSerializer = BsonSerializer.LookupSerializer(_memberType); //TODO ??
305305
var isBsonArraySerializer = wrappedSerializer is IBsonArraySerializer;
306306
var isBsonDocumentSerializer = wrappedSerializer is IBsonDocumentSerializer;
307307

@@ -329,7 +329,7 @@ public IBsonSerializer GetSerializer()
329329
}
330330
else
331331
{
332-
_serializer = BsonSerializer.LookupSerializer(_memberType);
332+
_serializer = BsonSerializer.LookupSerializer(_memberType); //TODO ??
333333
}
334334
}
335335
return _serializer;

src/MongoDB.Bson/Serialization/BsonSerializationProviderBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace MongoDB.Bson.Serialization
2424
public abstract class BsonSerializationProviderBase : IRegistryAwareBsonSerializationProvider
2525
{
2626
/// <inheritdoc/>
27-
public virtual IBsonSerializer GetSerializer(Type type) //TODO Need to make another version with the domain as input
27+
public virtual IBsonSerializer GetSerializer(Type type) //TODO We can keep this as is
2828
{
2929
return GetSerializer(type, BsonSerializer.SerializerRegistry);
3030
}
@@ -38,7 +38,7 @@ public virtual IBsonSerializer GetSerializer(Type type) //TODO Need to make ano
3838
/// <param name="serializerTypeDefinition">The serializer type definition.</param>
3939
/// <param name="typeArguments">The type arguments.</param>
4040
/// <returns>A serializer.</returns>
41-
protected virtual IBsonSerializer CreateGenericSerializer(Type serializerTypeDefinition, params Type[] typeArguments) //TODO We need another version of this with the domain as input
41+
protected virtual IBsonSerializer CreateGenericSerializer(Type serializerTypeDefinition, params Type[] typeArguments) //TODO We can keep this as is
4242
{
4343
return CreateGenericSerializer(serializerTypeDefinition, typeArguments, BsonSerializer.SerializerRegistry);
4444
}
@@ -65,7 +65,7 @@ protected virtual IBsonSerializer CreateGenericSerializer(Type serializerTypeDef
6565
/// <returns>A serializer.</returns>
6666
protected virtual IBsonSerializer CreateSerializer(Type serializerType)
6767
{
68-
return CreateSerializer(serializerType, BsonSerializer.SerializerRegistry); //TODO We need another version of this with the domain as input
68+
return CreateSerializer(serializerType, BsonSerializer.SerializerRegistry); //TODO We can keep this as is
6969
}
7070

7171
/// <summary>

src/MongoDB.Bson/Serialization/Conventions/LookupIdGeneratorConvention.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ public void PostProcess(BsonClassMap classMap)
3535
{
3636
if (idMemberMap.IdGenerator == null)
3737
{
38-
//TODO For this, we either add a new PostProcess method to the IPostProcessingConvention that takes the domain
3938
//or we pass the domain to the BsonClassMap. The first probably makes more sense, but it's messier.
40-
var idGenerator = BsonSerializer.LookupIdGenerator(idMemberMap.MemberType);
39+
var idGenerator = BsonSerializer.LookupIdGenerator(idMemberMap.MemberType); //TODO ??
4140
if (idGenerator != null)
4241
{
4342
idMemberMap.SetIdGenerator(idGenerator);

src/MongoDB.Bson/Serialization/Conventions/ObjectDiscriminatorConvention.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public Type GetActualType(IBsonReader bsonReader, Type nominalType)
135135
{
136136
discriminator = discriminator.AsBsonArray.Last(); // last item is leaf class discriminator
137137
}
138-
actualType = BsonSerializer.LookupActualType(nominalType, discriminator); //TODO For this (and other discriminator conventions) we need to add methods to IDiscriminatorConvention to pass the domain
138+
actualType = BsonSerializer.LookupActualType(nominalType, discriminator); //TODO ??
139139
}
140140
bsonReader.ReturnToBookmark(bookmark);
141141
return actualType;

src/MongoDB.Bson/Serialization/Conventions/StandardDiscriminatorConvention.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ public Type GetActualType(IBsonReader bsonReader, Type nominalType)
101101
if (bsonType == BsonType.Document)
102102
{
103103
// ensure KnownTypes of nominalType are registered (so IsTypeDiscriminated returns correct answer)
104-
BsonSerializer.EnsureKnownTypesAreRegistered(nominalType);
104+
BsonSerializer.EnsureKnownTypesAreRegistered(nominalType); //TODO ??
105105

106106
// we can skip looking for a discriminator if nominalType has no discriminated sub types
107-
if (BsonSerializer.IsTypeDiscriminated(nominalType))
107+
if (BsonSerializer.IsTypeDiscriminated(nominalType)) //TODO ??
108108
{
109109
var bookmark = bsonReader.GetBookmark();
110110
bsonReader.ReadStartDocument();
@@ -117,7 +117,7 @@ public Type GetActualType(IBsonReader bsonReader, Type nominalType)
117117
{
118118
discriminator = discriminator.AsBsonArray.Last(); // last item is leaf class discriminator
119119
}
120-
actualType = BsonSerializer.LookupActualType(nominalType, discriminator);
120+
actualType = BsonSerializer.LookupActualType(nominalType, discriminator); //TODO ??
121121
}
122122
bsonReader.ReturnToBookmark(bookmark);
123123
return actualType;

src/MongoDB.Bson/Serialization/Conventions/StringIdStoredAsObjectIdConvention.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void Apply(BsonMemberMap memberMap)
3838
return;
3939
}
4040

41-
var defaultStringSerializer = BsonSerializer.LookupSerializer(typeof(string)); //TODO For this we'd need to add a new Apply(memberMap, domain) method to IMemberMapConvention
41+
var defaultStringSerializer = BsonSerializer.LookupSerializer(typeof(string)); //TODO ??
4242
if (memberMap.GetSerializer() != defaultStringSerializer)
4343
{
4444
return;

src/MongoDB.Bson/Serialization/IBsonSerializerExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static TValue Deserialize<TValue>(this IBsonSerializer<TValue> serializer
5858
public static IDiscriminatorConvention GetDiscriminatorConvention(this IBsonSerializer serializer) =>
5959
serializer is IHasDiscriminatorConvention hasDiscriminatorConvention
6060
? hasDiscriminatorConvention.DiscriminatorConvention
61-
: BsonSerializer.LookupDiscriminatorConvention(serializer.ValueType); //TODO We need another version of this with the domain as input
61+
: BsonSerializer.LookupDiscriminatorConvention(serializer.ValueType); //TODO We can keep this as is
6262

6363
/// <summary>
6464
/// Serializes a value.

0 commit comments

Comments
 (0)