[CSHARP-2333] Custom Serializer returned value not being respected Created: 18/Jul/18 Updated: 20/Jan/20 Resolved: 20/Jan/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 2.7.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Magnus | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Cosmos Db |
||
| Description |
|
The string returned by my custom serializer, which is overriding how datetime strings are formatted is "2018-07-18T14:35:27.7108283+02:00". However in my database the stored value is "2018-07-18T12:35:27.7108283+00:00". My code:
The serializer is registered right before I Insert the document. What is happening to the value after I've serialized it and how can I change it?
|
| Comments |
| Comment by Robert Stam [ 02/Oct/18 ] | ||||||||||||||||||||
|
I tried your sample code and set a breakpoint to verify that the Serialize method in your custom serializer is in fact being called. I used the following class to test:
And the following test program:
The document inserted into the database looks just like you would expect:
So it looks like the driver is doing what we would expect. Are you doing something different than I am? | ||||||||||||||||||||
| Comment by Magnus [ 18/Jul/18 ] | ||||||||||||||||||||
|
Correction; the code for registering the serializer is
|