[CSHARP-742] exposing _T makes duplicates Created: 15/May/13 Updated: 20/May/19 Resolved: 20/May/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 1.8.1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Allan Zimmermann | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
VB/C# framework 4.0 / VS 2012 |
||
| Description |
|
If you decorate a property to expose _t, the driver bugs out and create 2 fields in all new documents with the same name of _t ... |
| Comments |
| Comment by Ian Whalen (Inactive) [ 20/May/19 ] | ||||||||||||||||||||
|
Given the lack of activity/interest expressed by the community we're not planning on implementing this. Closing as Won't Fix. | ||||||||||||||||||||
| Comment by Craig Wilson [ 16/May/13 ] | ||||||||||||||||||||
|
I concur with the feature request. It would be nice for users to be able to specify a particular member as the discriminated value rather than a made element. Save storage space and enable some reuse. Users could obviously mess this up by having two difference instances return the same discriminator value, but I think it is worth the feature to enable this. | ||||||||||||||||||||
| Comment by Robert Stam [ 15/May/13 ] | ||||||||||||||||||||
|
This should probably be reclassified as a feature request. The discriminator has been considered a private element used by the driver to figure out the actual type of the document during deserialization. It was not anticipated that the discriminator would also be exposed as a regular property of the class. There are two possible courses of actions here: 1. Prohibit mapping a property to the element name "_t", thus protecting the private nature of the discriminator There are probably some edge cases with the second option (for example, how to prevent the application from writing invalid values to the discriminator?). | ||||||||||||||||||||
| Comment by Robert Stam [ 15/May/13 ] | ||||||||||||||||||||
|
Note: Edited from original version. To reproduce use these classes:
and this code:
and the output is:
If you use the shell to check the document the result is a little odd because the shell doesn't really support duplicate elements:
|