[CSHARP-4580] ExtraElements containing POCO classes fail to serialize Created: 24/Mar/23 Updated: 10/Apr/23 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Ahmed Fwela | Assignee: | Boris Dogadov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
| Comments |
| Comment by Boris Dogadov [ 10/Apr/23 ] | |||||||||||||||
|
Hi ahmednfwela@bdaya-dev.com We will evaluate supporting POCOs in ExtraElements feature as part of our roadmap. | |||||||||||||||
| Comment by Boris Dogadov [ 27/Mar/23 ] | |||||||||||||||
|
Thanks ahmednfwela@bdaya-dev.com, We will investigate this use case further. | |||||||||||||||
| Comment by Ahmed Fwela [ 27/Mar/23 ] | |||||||||||||||
|
Exact use case: ABP framework they support extending objects by an arbitrary
instead of users redefining their classes, but currently they are mapping those extra fields as extra elements so that they would go into the original object (and feel kind of natural in the database)
| |||||||||||||||
| Comment by Boris Dogadov [ 27/Mar/23 ] | |||||||||||||||
|
Currently POCOs are not supported in ExtraElements. The proposed workaround does solve the serialization issue, but unfortunately does not support a serialization/deserialization roundtrip (POCOs are deserialized as Dictionary). Depending on the particular use case, there might be different more suitable solutions for this problem. For example just having non ExtraElements member:
It would be helpful to understand the exact use case better, in order to recommend the best solution. | |||||||||||||||
| Comment by Ahmed Fwela [ 24/Mar/23 ] | |||||||||||||||
|
workaround:
for each class:
|