-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.7
-
Component/s: Feature Request
-
None
In the last version I was using (1.4), I was able to register a serializer that could assign any value to a field of type Object by calling the appropriate deserializer based on the BSON type and then assigning the result to the field. For example, given the following class definition:
public class Stuff
{
public string Id
public object TheStuff { get; set; }
}
I could persist anything as TheStuff and my custom serializer would deserialize and assign the value appropriately.
However, it doesn't seem possible to override the default serializers in the latest version, try though I might to find such a mechanism in the documentation and the source code. In the LookupSerializer method, the method returns as soon as it has found a mapped serializer, and as far as I can tell, the default serializers are getting registered before I have an opportunity to register my own. Registering a custom provider doesn't help either, as the driver only does a custom provider look-up if it hasn't found a serializer in the default dictionary.