Skip to content

Commit cf05d41

Browse files
committed
Improved interfaces
1 parent 3dadb07 commit cf05d41

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

src/MongoDB.Bson/Serialization/BsonClassMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public static BsonClassMap LookupClassMap(Type classType)
375375
/// </summary>
376376
/// <typeparam name="TClass">The class.</typeparam>
377377
/// <returns>The class map.</returns>
378-
public static BsonClassMap<TClass> RegisterClassMap<TClass>()
378+
public static BsonClassMap<TClass> RegisterClassMap<TClass>() //TODO We should move the static methods here to IBSonSerializerDomain
379379
{
380380
return RegisterClassMap<TClass>(cm => { cm.AutoMap(); });
381381
}

src/MongoDB.Bson/Serialization/IBsonSerializationDomain.cs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace MongoDB.Bson.Serialization
1010
/// <summary>
1111
/// //TODO
1212
/// </summary>
13-
public interface ISerializerConfigurator
13+
public interface IBsonSerializationConfigurator
1414
{
1515
/// <summary>
1616
/// Registers the discriminator for a type.
@@ -77,12 +77,23 @@ void RegisterGenericSerializerDefinition(
7777
/// <param name="serializer">The serializer.</param>
7878
/// <returns>True if the serializer was registered on this call, false if the same serializer was already registered on a previous call, throws an exception if a different serializer was already registered.</returns>
7979
bool TryRegisterSerializer<T>(IBsonSerializer<T> serializer);
80+
81+
/// <summary>
82+
/// Gets or sets whether to use the NullIdChecker on reference Id types that don't have an IdGenerator registered.
83+
/// </summary>
84+
bool UseNullIdChecker { get; set; } //TODO This should become a getter only property and a method
85+
86+
/// <summary>
87+
/// Gets or sets whether to use the ZeroIdChecker on value Id types that don't have an IdGenerator registered.
88+
/// </summary>
89+
bool UseZeroIdChecker { get; set; }
90+
8091
}
8192

8293
/// <summary>
8394
/// //TODO
8495
/// </summary>
85-
public interface IMainSerializer
96+
public interface IBsonCoreSerializer //TODO Don't like the name but have no better idea at the moment
8697
{
8798
/// <summary>
8899
/// Deserializes an object from a BsonDocument.
@@ -237,23 +248,8 @@ void Serialize(
237248
/// <summary>
238249
/// //TODO
239250
/// </summary>
240-
public interface IBsonSerializationDomain : ISerializerConfigurator, IMainSerializer
251+
public interface IBsonSerializationConfiguration
241252
{
242-
/// <summary>
243-
/// Gets the serializer registry.
244-
/// </summary>
245-
IBsonSerializerRegistry SerializerRegistry { get; }
246-
247-
/// <summary>
248-
/// Gets or sets whether to use the NullIdChecker on reference Id types that don't have an IdGenerator registered.
249-
/// </summary>
250-
bool UseNullIdChecker { get; set; }
251-
252-
/// <summary>
253-
/// Gets or sets whether to use the ZeroIdChecker on value Id types that don't have an IdGenerator registered.
254-
/// </summary>
255-
bool UseZeroIdChecker { get; set; }
256-
257253
/// <summary>
258254
/// Returns whether the given type has any discriminators registered for any of its subclasses.
259255
/// </summary>
@@ -298,6 +294,17 @@ public interface IBsonSerializationDomain : ISerializerConfigurator, IMainSerial
298294
IBsonSerializer LookupSerializer(Type type);
299295
}
300296

297+
/// <summary>
298+
/// //TODO
299+
/// </summary>
300+
public interface IBsonSerializationDomain : IBsonSerializationConfigurator, IBsonSerializationConfiguration, IBsonCoreSerializer
301+
{
302+
/// <summary>
303+
/// Gets the serializer registry.
304+
/// </summary>
305+
IBsonSerializerRegistry SerializerRegistry { get; }
306+
}
307+
301308
internal interface IBsonSerializationDomainInternal : IBsonSerializationDomain
302309
{
303310
ReaderWriterLockSlim ConfigLock { get; }

0 commit comments

Comments
 (0)