解决 sqllite 时间字段丢失毫秒部分的bug



FreeSql.Internal.Utils.TypeHandlers.TryAdd(typeof(DateTime), new DateTimeTypeHandler());

class DateTimeTypeHandler : TypeHandler<DateTime>
{
public override object Serialize(DateTime value) => value.ToString("yyyy-MM-dd HH:mm:ss.fff");
public override DateTime Deserialize(object value) => DateTime.TryParse(string.Concat(value), out var trydo) ? trydo : DateTime.MinValue;
// public override void FluentApi(ColumnFluent col) => col.MapType(typeof(string)).StringLength(12);
}
posted @ 2024-10-16 16:00  China Soft  阅读(7)  评论(0编辑  收藏  举报