mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
float? BUG
This commit is contained in:
@@ -50,7 +50,8 @@ SqlFunc.Contains(u.BuildName, keyword) || SqlFunc.IsNullOrEmpty(keyword)))
|
|||||||
}).OrderBy((r) => r.RoomNumber, type: OrderByType.Desc).ToPageListAsync(1, 2).Wait();
|
}).OrderBy((r) => r.RoomNumber, type: OrderByType.Desc).ToPageListAsync(1, 2).Wait();
|
||||||
|
|
||||||
GetInstance().Updateable<Student>().UpdateColumns(it =>
|
GetInstance().Updateable<Student>().UpdateColumns(it =>
|
||||||
new Student() {
|
new Student()
|
||||||
|
{
|
||||||
Name = "a".ToString(),
|
Name = "a".ToString(),
|
||||||
CreateTime = DateTime.Now.AddDays(-1)
|
CreateTime = DateTime.Now.AddDays(-1)
|
||||||
|
|
||||||
@@ -62,6 +63,21 @@ SqlFunc.Contains(u.BuildName, keyword) || SqlFunc.IsNullOrEmpty(keyword)))
|
|||||||
JoinType.Left,st.SchoolId==sc.Id&&st.CreateTime==DateTime.Now.AddDays(-1)
|
JoinType.Left,st.SchoolId==sc.Id&&st.CreateTime==DateTime.Now.AddDays(-1)
|
||||||
})
|
})
|
||||||
.Where(st => st.Name == "jack").ToList();
|
.Where(st => st.Name == "jack").ToList();
|
||||||
|
|
||||||
|
|
||||||
|
GetInstance().Updateable<BugStudent>().Where(it => true).UpdateColumns(it => new BugStudent() { Float = 11 }).ExecuteCommand();
|
||||||
|
var reslut= GetInstance().Queryable<BugStudent>().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[SugarTable("student")]
|
||||||
|
public class BugStudent
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public float? Float { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class MainTable
|
public class MainTable
|
||||||
{
|
{
|
||||||
|
@@ -53,6 +53,7 @@ namespace SqlSugar
|
|||||||
private static readonly MethodInfo getTime = typeof(IDataRecordExtensions).GetMethod("GetTime");
|
private static readonly MethodInfo getTime = typeof(IDataRecordExtensions).GetMethod("GetTime");
|
||||||
private static readonly MethodInfo getConvertDecimal = typeof(IDataRecordExtensions).GetMethod("GetConvertDecimal");
|
private static readonly MethodInfo getConvertDecimal = typeof(IDataRecordExtensions).GetMethod("GetConvertDecimal");
|
||||||
private static readonly MethodInfo getConvertDouble = typeof(IDataRecordExtensions).GetMethod("GetConvertDouble");
|
private static readonly MethodInfo getConvertDouble = typeof(IDataRecordExtensions).GetMethod("GetConvertDouble");
|
||||||
|
private static readonly MethodInfo getConvertDoubleToFloat = typeof(IDataRecordExtensions).GetMethod("GetConvertDoubleToFloat");
|
||||||
private static readonly MethodInfo getConvertGuid = typeof(IDataRecordExtensions).GetMethod("GetConvertGuid");
|
private static readonly MethodInfo getConvertGuid = typeof(IDataRecordExtensions).GetMethod("GetConvertGuid");
|
||||||
private static readonly MethodInfo getConvertInt16 = typeof(IDataRecordExtensions).GetMethod("GetConvertInt16");
|
private static readonly MethodInfo getConvertInt16 = typeof(IDataRecordExtensions).GetMethod("GetConvertInt16");
|
||||||
private static readonly MethodInfo getConvertInt32 = typeof(IDataRecordExtensions).GetMethod("GetConvertInt32");
|
private static readonly MethodInfo getConvertInt32 = typeof(IDataRecordExtensions).GetMethod("GetConvertInt32");
|
||||||
@@ -265,6 +266,9 @@ namespace SqlSugar
|
|||||||
method = isNullableType ? getConvertDouble : getDouble;
|
method = isNullableType ? getConvertDouble : getDouble;
|
||||||
else
|
else
|
||||||
method = isNullableType ? getConvertFloat : getFloat;
|
method = isNullableType ? getConvertFloat : getFloat;
|
||||||
|
if (dbTypeName == "float" && isNullableType && bindProperyTypeName == "single") {
|
||||||
|
method = getConvertDoubleToFloat;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CSharpDataType.Guid:
|
case CSharpDataType.Guid:
|
||||||
CheckType(bind.GuidThrow, bindProperyTypeName, validPropertyName, propertyName);
|
CheckType(bind.GuidThrow, bindProperyTypeName, validPropertyName, propertyName);
|
||||||
|
@@ -95,6 +95,18 @@ namespace SqlSugar
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static float? GetConvertDoubleToFloat(this IDataRecord dr, int i)
|
||||||
|
{
|
||||||
|
if (dr.IsDBNull(i))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var result = dr.GetDouble(i);
|
||||||
|
return Convert.ToSingle(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Guid? GetConvertGuid(this IDataRecord dr, int i)
|
public static Guid? GetConvertGuid(this IDataRecord dr, int i)
|
||||||
{
|
{
|
||||||
if (dr.IsDBNull(i))
|
if (dr.IsDBNull(i))
|
||||||
|
Reference in New Issue
Block a user