How to customize DateTime value's storage format?
sdghchj opened this issue · 3 comments
` public class JsonGrainStateSerializer : IGrainStateSerializer
{
private readonly JsonSerializer serializer;
public JsonGrainStateSerializer(ITypeResolver typeResolver, IGrainFactory grainFactory)
: this(JsonSerializer.Create(OrleansJsonSerializer.GetDefaultSerializerSettings(typeResolver, grainFactory)))
{
}
.....
}`
public class JsonSerializerSettings
{
......
internal const string DefaultDateFormatString = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
......
}
As the DefaultSerializerSettings is used to construct JsonGrainStateSerializer , so the the DefaultDateFormatString is also used to serialize DateTime members of a grain state. I am now using MongoDB as the storage database, however a DateTime type value is stored as string type while I want it to be DateTime type in MongoDB. I found there is no way I can change its format in my orleans based project.
Thank you. I fork your project and modifed the DateTime type's serialization. Please check the pull request.
over