I want to use Patch with Delta to update an object, which has Timespan property i haven't got any error, but the Timespan properties are all 0:00:00, i think they're simple ignored.
i can see 0 at the timespan property just when the method in the controller stops at the breakpoint. i don't make any change on the data at that stage. it is sure i send not empty timespan from the client
{"TevID":2,"TevName":"this is the name","TotalTime":"01:03:00","FreeTime":"02:30:00"}
[HttpPatch]
public async Task<IHttpActionResult> Patch(int id, Delta<TTevekenyseg> modified) {
Log.Info("Update-ID: {0}", id);
...
}
do you have any information, if Delta works for Timespans?
Delta<T> doesn't work for TimeSpans. It's a pretty flawed class so I wrote my own called Patchable<T>. The main problem I found was Delta<T>'s incompatibility with JSON.Net. Its lack of support for TimeSpan was confirmation I did the right thing.
See the answer to this question (a long read sorry)
The answer has TrySetInt32. The equivalent method TrySetTimeSpan works perfectly.