【发布时间】:2018-08-01 03:58:55
【问题描述】:
我让 ServiceStack OrmLite (5.1.1) 创建表,并持久化包含 TimeSpan 的对象:
// ...
public TimeSpan _Jobs_VehicleNotificationTime { get; set; }
// ...
当我尝试读回它时,我收到了这个错误:
System.InvalidCastException: 'Invalid cast from 'System.Int64' to 'System.TimeSpan'.'
is persisted as a long 的值似乎是:
但我在使用 FromObjectDictionary 方法时得到了这个:
错误是:
at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
at ServiceStack.PlatformExtensions.ObjectDictionaryFieldDefinition.SetValue(Object instance, Object value)
at ServiceStack.PlatformExtensions.FromObjectDictionary(IReadOnlyDictionary`2 values, Type type)
at tWorks.Core.CoreServerCommons.Handlers.OrmLiteDbHandler.<>c__DisplayClass65_1.<ReadObjects>b__1(Dictionary`2 x) in D:\[GIT]\Core\CoreServerCommons\Handlers\DbHandlers\OrmLite\OrmLiteDbHandler.cs:line 577
这是一个错误还是我遗漏了什么?
【问题讨论】:
标签: c# mysql timespan ormlite-servicestack