Update core

This commit is contained in:
skx
2020-12-30 18:44:34 +08:00
parent 02e7e72bb5
commit 2ef8e14522
3 changed files with 32 additions and 7 deletions

View File

@@ -280,6 +280,8 @@ namespace SqlSugar
method = isNullableType ? getConvertDateTime : getDateTime;
if (bindProperyTypeName == "datetime" && dbTypeName.ToLower() == "time")
method = isNullableType ? getConvertTime : getTime;
if (bindProperyTypeName == "datetimeoffset")
method = isNullableType ? getConvertdatetimeoffset : getdatetimeoffset;
break;
case CSharpDataType.@decimal:
CheckType(bind.DecimalThrow, bindProperyTypeName, validPropertyName, propertyName);

View File

@@ -217,9 +217,17 @@ namespace SqlSugar
{
return default(DateTimeOffset);
}
var result = (DateTimeOffset)dr.GetValue(i);
var date = dr.GetValue(i);
if (date is DateTime)
{
return UtilMethods.GetDateTimeOffsetByDateTime((DateTime)(date));
}
else
{
var result = (DateTimeOffset)date;
return result;
}
}
public static DateTimeOffset? GetConvertdatetimeoffset(this IDataRecord dr, int i)
{
@@ -227,9 +235,17 @@ namespace SqlSugar
{
return default(DateTimeOffset);
}
var result = (DateTimeOffset)dr.GetValue(i);
var date = dr.GetValue(i);
if (date is DateTime)
{
return UtilMethods.GetDateTimeOffsetByDateTime((DateTime)(date));
}
else
{
var result = (DateTimeOffset)date;
return result;
}
}
public static string GetConvertString(this IDataRecord dr, int i)

View File

@@ -154,6 +154,13 @@ namespace SqlSugar
return (T)Convert.ChangeType(obj, typeof(T));
}
internal static DateTimeOffset GetDateTimeOffsetByDateTime(DateTime date)
{
date = DateTime.SpecifyKind(date, DateTimeKind.Utc);
DateTimeOffset utcTime2 = date;
return utcTime2;
}
internal static void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex, string append = null)
{
if (appendSql.HasValue() && parameters.HasValue())