[CSHARP-4391] BsonClassMap should support deserializing structs using a constructor Created: 28/Oct/22  Updated: 01/Nov/22  Resolved: 01/Nov/22

Status: Closed
Project: C# Driver
Component/s: Serialization
Affects Version/s: 2.18.0
Fix Version/s: 2.19.0

Type: New Feature Priority: Unknown
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CSHARP-1326 Grouping mongodb filtered results by ... Closed
Related
related to CSHARP-4392 Consider specialized subclasses of Bs... Backlog

 Description   

BsonClassMap does not support deserializing structs because of boxing.

But boxing is only really an issue when trying to set property values (because the value is set on a boxed value that gets thrown away).

But if a struct provides the proper constructor(s) BsonClassMap can be modified to support deserializing structs using a constructor, as opposed to trying to set property values.



 Comments   
Comment by Githook User [ 01/Nov/22 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-4391: BsonClassMap should support deserializing structs using a constructor.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/d65280354c4099a4e37e2aed303953079699bbb3

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