[CSHARP-2175] Can I access another field/property during Serialization? Created: 05/Feb/18 Updated: 27/Oct/23 Resolved: 01/Apr/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Anup Marwadi | Assignee: | Wan Bachtiar |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
Hello, Here is a stack overflow link that has gone unanswered: I have also posted on the MongoDB Google group: Unless I'm mistaken, there's no possible way to accomplish this? Thank you |
| Comments |
| Comment by Wan Bachtiar [ 19/Mar/19 ] | |||||||||||||||||||||||||||
Hi Anup, You can do this by writing and registering a custom serializer for the class. Depending on your requirements and user case, you can even rewrite the entire document in the serialization, for example if you have a class:
You can write a custom serializer as below example:
Please note that the CSHARP project is for reporting bugs or feature suggestions for the MongoDB .NET/C# driver. Regards, |