- 优化 TypeHandlers 支持 Enum 枚举映射规则;#1634

This commit is contained in:
2881099
2024-02-08 13:06:43 +08:00
parent 91362ad07a
commit 53443dc22b
34 changed files with 120 additions and 529 deletions

View File

@ -51,9 +51,6 @@ namespace FreeSql.Custom
{
if (value == null) return "NULL";
if (value.Equals(DateTime.MinValue) == true) value = new DateTime(1970, 1, 1);
if (value is DateTime && Utils.TypeHandlers.TryGetValue(typeof(DateTime), out var typeHandler)) return typeHandler.Serialize(value)?.ToString();
if (value is DateTime? && Utils.TypeHandlers.TryGetValue(typeof(DateTime?), out var typeHandler2)) return typeHandler2.Serialize(value)?.ToString();
return string.Concat("'", ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss"), "'");
}
public virtual string TimeSpanRawSql(object value) => value == null ? "NULL" : ((TimeSpan)value).TotalSeconds.ToString();