[CSHARP-169] Deserialize Arrays to Properties without Setter Created: 14/Feb/11 Updated: 08/Feb/23 Resolved: 03/Dec/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Feature Request |
| Affects Version/s: | 0.11 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Thomas Tucker | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Provide support for De-serializing Arrays to read only properties Like so: public IEnumerable<contact> Contacts } |
| Comments |
| Comment by Daniel Hegener [ 24/Nov/17 ] |
|
Potential duplicate of |
| Comment by David Pfeffer [ 29/Jul/13 ] |
|
I really need to be able to reuse my existing, constructor instantiated, instances. |
| Comment by Alexander Nagy [ 16/Apr/12 ] |
|
IMO a better way to implement this would be to have a private setter and support a PrivateMemberFinderConvention. Such an approach would be cleaner and wouldn't require decompilation with semantic inference. Example: private List<contact> _contacts; public IEnumerable<contact> Contacts { get { if (_contacts == null) _contacts = new List<contact>(); return _contacts; }} var conventionProfile = ConventionProfile.GetDefault() BsonClassMap.RegisterConventions( BTW, we've already got this implemented in our private fork, wouldn't be hard to push this out. |