Browse Source

Removed UnregisterConventions, UnregisterGenericSerializerDefinition, UnregisterIdGenerator and UnregisterSerializer. All serialization configuration must happen once at program startup and remain static thereafter, so Unregister methods are not appropriate.

pull/51/head
rstam 15 years ago
parent
commit
f16ab659a9
  1. 17
      Bson/DefaultSerializer/BsonClassMap.cs
  2. 36
      Bson/Serialization/BsonSerializer.cs

17
Bson/DefaultSerializer/BsonClassMap.cs

@ -229,7 +229,7 @@ namespace MongoDB.Bson.DefaultSerializer {
}
/// <summary>
/// Looks up a class map.
/// Looks up a class map (will AutoMap the class if no class map is registered).
/// </summary>
/// <param name="classType">The class type.</param>
/// <returns>The class map.</returns>
@ -320,21 +320,6 @@ namespace MongoDB.Bson.DefaultSerializer {
};
profiles.Add(filtered);
}
/// <summary>
/// Unregisters a conventions profile.
/// </summary>
/// <param name="conventions">The conventions profile.</param>
public static void UnregisterConventions(
ConventionProfile conventions
) {
for (int i = 0; i < profiles.Count; i++) {
if (profiles[i].Profile == conventions) {
profiles.RemoveAt(i);
return;
}
}
}
#endregion
#region public methods

36
Bson/Serialization/BsonSerializer.cs

@ -446,42 +446,6 @@ namespace MongoDB.Bson.Serialization {
var serializer = LookupSerializer(actualType);
serializer.Serialize(bsonWriter, nominalType, value, options);
}
/// <summary>
/// Unregisters a generic serializer definition for a generic type.
/// </summary>
/// <param name="genericTypeDefinition">The generic type.</param>
public static void UnregisterGenericSerializerDefinition(
Type genericTypeDefinition
) {
lock (staticLock) {
genericSerializerDefinitions.Remove(genericTypeDefinition);
}
}
/// <summary>
/// Unregisters an IdGenerator for an Id type.
/// </summary>
/// <param name="type">The Id type.</param>
public static void UnregisterIdGenerator(
Type type
) {
lock (staticLock) {
idGenerators.Remove(type);
}
}
/// <summary>
/// Unregisters a serializer for a type.
/// </summary>
/// <param name="type">The type.</param>
public static void UnregisterSerializer(
Type type
) {
lock (staticLock) {
serializers.Remove(type);
}
}
#endregion
#region private static methods

Loading…
Cancel
Save