mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Time configuration
This commit is contained in:
@@ -177,6 +177,10 @@ namespace SqlSugar
|
||||
{
|
||||
item[col.ColumnName] = string.Empty;
|
||||
}
|
||||
else if (col.DataType == UtilConstants.DateType)
|
||||
{
|
||||
item[col.ColumnName] =UtilMethods.GetMinDate(this.context.CurrentConnectionConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
item[col.ColumnName] = Activator.CreateInstance(col.DataType);
|
||||
|
@@ -14,6 +14,7 @@ namespace SqlSugar
|
||||
public bool DisableMillisecond { get; set; }
|
||||
public bool PgSqlIsAutoToLower = true;
|
||||
public int DefaultCacheDurationInSeconds { get; set; }
|
||||
public bool? TableEnumIsString { get; set; }
|
||||
public bool? TableEnumIsString { get; set; }
|
||||
public DateTime? DbMinDate { get; set; } = Convert.ToDateTime("1900-01-01");
|
||||
}
|
||||
}
|
||||
|
@@ -193,6 +193,23 @@ namespace SqlSugar
|
||||
{
|
||||
return (T)To(value, typeof(T));
|
||||
}
|
||||
|
||||
internal static DateTime GetMinDate(ConnectionConfig currentConnectionConfig)
|
||||
{
|
||||
if (currentConnectionConfig.MoreSettings == null)
|
||||
{
|
||||
return Convert.ToDateTime("1900-01-01");
|
||||
}
|
||||
else if (currentConnectionConfig.MoreSettings.DbMinDate == null)
|
||||
{
|
||||
return Convert.ToDateTime("1900-01-01");
|
||||
}
|
||||
else
|
||||
{
|
||||
return currentConnectionConfig.MoreSettings.DbMinDate.Value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Type GetUnderType(Type oldType)
|
||||
{
|
||||
Type type = Nullable.GetUnderlyingType(oldType);
|
||||
|
Reference in New Issue
Block a user