[CSHARP-3985] Support multiple SerializerRegistry(s) Created: 05/Dec/21  Updated: 09/Jan/24

Status: Backlog
Project: C# Driver
Component/s: None
Affects Version/s: 2.14.0
Fix Version/s: 3.0.0

Type: Improvement Priority: Unknown
Reporter: Mirko Da Corte Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-655 Proposal: support multiple serializat... Closed
Epic Link: Implement 3.0 release
Quarter: FY24Q3
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

The class MongoCollectionSettings exposes the property SerializerRegistry with only a getter, and it always return the static instance of BsonSerializer.SerializerRegistry.
There is no way for pass a custom instance of SerializerRegistry, even if this was evidently the intention having it as a settings property.

I propose to add a setter, keeping static instance as default, but permitting to change it if needed.



 Comments   
Comment by Shay Nissel [ 26/May/23 ]

That feature would be extremely helpful. 
I'll add to that the need to do the same for convention packs.

Trying to integrate apps to use multiple databases/collections that are using different serializations and conventions.

For now, our only solution is convert all databases/collections to adhere to the same settings.

Comment by Mirko Da Corte [ 06/Dec/21 ]

Yes, I saw your previous ticket. This proposed by me was a simpler middle-step for reach final target of having a multi-context env. I had to fork the library because this is a blocking missing feature for another my project. Anyway, I really hope that multi-context will be released with 3.0 drivers!

Comment by Robert Stam [ 06/Dec/21 ]

See the discussion for a very similar ticket created for the 1.x driver a long time ago: https://jira.mongodb.org/browse/CSHARP-655.

Comment by Robert Stam [ 06/Dec/21 ]

Hi Mirko,

Thank you for submitting this proposal. 

The idea of supporting multiple serializer registries has been around for awhile, but it almost certainly involves much more work than just making this settings property settable.

We certainly expect to eventually support multiple serializer registries, but not in the short term. Perhaps in the next major version of the driver.

 

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