Time configuration

This commit is contained in:
sunkaixuan
2022-05-13 22:06:08 +08:00
parent 9a806b1b74
commit 1ba4ff0066
10 changed files with 19 additions and 19 deletions

View File

@@ -190,9 +190,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

View File

@@ -292,9 +292,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

View File

@@ -52,9 +52,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

View File

@@ -45,9 +45,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

View File

@@ -107,9 +107,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

View File

@@ -117,9 +117,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

View File

@@ -53,9 +53,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

View File

@@ -141,7 +141,7 @@ namespace SqlSugar
var date = Convert.ToDateTime(sqlParameter.Value); var date = Convert.ToDateTime(sqlParameter.Value);
if (date==DateTime.MinValue) if (date==DateTime.MinValue)
{ {
sqlParameter.Value = Convert.ToDateTime("1753/01/01"); sqlParameter.Value =UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
} }
if (parameter.Direction == 0) if (parameter.Direction == 0)

View File

@@ -91,9 +91,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

View File

@@ -47,9 +47,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType && iswhere == false) if (type == UtilConstants.DateType && iswhere == false)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {