[CSHARP-2387] EnumRepresentationConvention BsonType.String doesn't serialize enums to strings if the enums are in a list Created: 14/Sep/18 Updated: 09/Oct/18 Resolved: 09/Oct/18 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 2.7.0 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jeffrey Stapleton | Assignee: | Robert Stam |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10, 64-bit architecture, .NetFramework 471 |
||
| Issue Links: |
|
||||||||
| Description |
|
Create a serialization convention like so:
Then define an enum like so:
Finally add a list of enums to your data model
Write to mongodb then inspect the bson doc and notice that `JobCategory` is a list of int32 and not a list of strings.
|
| Comments |
| Comment by Robert Stam [ 09/Oct/18 ] |
|
This is a reasonable request that is scheduled to be addressed in a future version of the driver. Currently the convention only applies to fields of an enum or nullable enum type. See CSHARP-2096. |