[CSHARP-111] Enhance AddToSet and AddToSetEach to work with custom C# classes Created: 22/Nov/10  Updated: 02/Apr/15  Resolved: 22/Nov/10

Status: Closed
Project: C# Driver
Component/s: Feature Request
Affects Version/s: 0.7
Fix Version/s: 0.9

Type: Improvement Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

UpdateBuilder's AddToSet and AddToSetEach currently only work with BsonValues. Enhance these methods to work with custom C# classes so callers don't have to write code to convert their custom C# values to BsonValues.



 Comments   
Comment by Robert Stam [ 22/Nov/10 ]

The implementation of this feature required new method names (AddToSetWrapped and AddToSetEachWrapped) because generic methods and overloads interact horribly producing really weird results (in the sense that the compiler chooses an overload that isn't the one you might expect). By using a different name the ambiguities are avoided. Note that using the new Wrapped methods is more efficient than the workaround suggested earlier. That workaround involves a deserialization round-trip to convert a C# class to a BsonDocument, whereas the Wrapped methods use the BsonDocumentWrapper to allow serialization to only occur once.

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