mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-15 20:49:31 +08:00
Update .net core project
This commit is contained in:
parent
454528d9ae
commit
895f1079c0
@ -378,6 +378,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
defaultValue = "";
|
defaultValue = "";
|
||||||
}
|
}
|
||||||
|
if (defaultValue.IsDate())
|
||||||
|
{
|
||||||
|
defaultValue = "'" + defaultValue + "'";
|
||||||
|
}
|
||||||
string sql = string.Format(AddDefaultValueSql, tableName, columnName,defaultValue);
|
string sql = string.Format(AddDefaultValueSql, tableName, columnName,defaultValue);
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
|
@ -116,6 +116,10 @@ namespace SqlSugar
|
|||||||
return Convert.ToInt64(value);
|
return Convert.ToInt64(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (type == UtilConstants.DateTimeOffsetType)
|
||||||
|
{
|
||||||
|
return GetDateTimeOffsetString(value);
|
||||||
|
}
|
||||||
else if (type == UtilConstants.ByteArrayType)
|
else if (type == UtilConstants.ByteArrayType)
|
||||||
{
|
{
|
||||||
var parameterName = this.Builder.SqlParameterKeyWord + name + i;
|
var parameterName = this.Builder.SqlParameterKeyWord + name + i;
|
||||||
@ -132,9 +136,29 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "'"+value.ToString() + "'";
|
return "'" + value.ToString() + "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeOffsetString(object value)
|
||||||
|
{
|
||||||
|
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeString(object value)
|
||||||
|
{
|
||||||
|
var date = value.ObjToDate();
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,12 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
sqlParameter.DbType = System.Data.DbType.AnsiString;
|
sqlParameter.DbType = System.Data.DbType.AnsiString;
|
||||||
}
|
}
|
||||||
|
else if (parameter.DbType == System.Data.DbType.DateTimeOffset)
|
||||||
|
{
|
||||||
|
if (sqlParameter.Value != DBNull.Value)
|
||||||
|
sqlParameter.Value = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)sqlParameter.Value);
|
||||||
|
sqlParameter.DbType = System.Data.DbType.DateTime;
|
||||||
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user