Add ConnMoreSettings.DisableMillisecond

This commit is contained in:
sunkaixuan 2022-04-14 18:54:14 +08:00
parent 307c461cf7
commit edba4ab1c0
3 changed files with 17 additions and 2 deletions

View File

@ -11,6 +11,7 @@ namespace SqlSugar
public bool IsWithNoLockQuery { get; set; }
public bool DisableNvarchar { get; set; }
public bool DisableMillisecond { get; set; }
public bool PgSqlIsAutoToLower = true;
public int DefaultCacheDurationInSeconds { get; set; }
public bool? TableEnumIsString { get; set; }

View File

@ -95,7 +95,14 @@ namespace SqlSugar
{
date = Convert.ToDateTime("1900-1-1");
}
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
else
{
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
}
}
else if (type.IsEnum())
{

View File

@ -51,7 +51,14 @@ namespace SqlSugar
{
date = Convert.ToDateTime("1900-1-1");
}
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
else
{
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
}
}
else if (type == UtilConstants.DateType && iswhere)
{