[CSHARP-583] Allow Injection of custom primitive serializers into existing Seralization Stack Created: 28/Sep/12  Updated: 05/Apr/19  Resolved: 28/Sep/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 2.0
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Daniel Sinclair Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: c#, driver, question, serialization, serializers
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Duplicate
is duplicated by CSHARP-587 Overwrite serializers in BsonSerializer Closed

 Description   

I would like to be able to allow for custom serialization without having to replace the entire serialization stack. This would be relatively easy to do except that the relevant classes are sealed and there's no hook to modify the static list of serializers used by default.

For instance, if I want to replace the DateTime serializer, or the Int64 serlializer I want to be able to add that into the existing stack. I do not want to have to completely replace the entire stack.

See here;

http://stackoverflow.com/questions/12201812/mongodb-override-default-serializer-for-a-c-sharp-primitive-type



 Comments   
Comment by Craig Wilson [ 11/Oct/12 ]

This works as designed.

Comment by Robert Stam [ 28/Sep/12 ]

You can easily register your own serializers, you just have to register your serializers early enough (before the driver registers one).

I wrote a detailed answer to the stackoverflow question so please read that for further details.

Generated at Wed Feb 07 21:37:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.