I have a POCO like this:
public class BlogEntry
{
public string Title { get; set; }
public DateTime Date { get; set; }
}
Most of the time it's being hydrated from Entity Framework, but it can and will be used outside of Entity Framework.
The DateTimeKind for the Date from EF is Unspecified, which from what I read is normal.
When I cache this POCO in Redis (using the ServiceStack Redis client), it comes back with a DateTimeKind of Local.
So there is a jitter with the returned objects. The first pass (uncached) has ISO-8601 with no offset (DateTimeKind.Unspecified). The second pass (cached) is ISO-8601 with an offset (from Redis with DateTimeKind.Local).
Any way to force the ServiceStack JSON serializer to always interpret dates as a given DateTimeKind? (I know there is a "JsConfig.AppendUtcOffset" property, but whether it's true or false, the values never change for me?)
Or somewhere in the deserialization process from my typed RedisClient to make the DateTimeKind local?
I can manually change my POCO's to enforce the DateTimeKind - and that works - but I was hoping for something less error prone.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…