mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Update exp to sql
This commit is contained in:
parent
997c61735a
commit
9ac7f1b2bc
@ -54,8 +54,37 @@ namespace OrmTest
|
|||||||
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
||||||
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
||||||
|
|
||||||
|
|
||||||
|
sql = Db.Updateable<UnitDiary>().SetColumns(it => new UnitDiary()
|
||||||
|
{
|
||||||
|
TypeID = saveDiary.TypeID,
|
||||||
|
}).Where(it => it.ID == saveDiary.ID).ToSql();
|
||||||
|
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
||||||
|
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
||||||
|
|
||||||
|
sql=Db.Updateable<NullTest>().SetColumns(it => new NullTest()
|
||||||
|
{
|
||||||
|
p = true
|
||||||
|
|
||||||
|
}).Where(it => it.id == 1).ToSql();
|
||||||
|
UValidate.Check(sql.Key, @"UPDATE [NullTest] SET
|
||||||
|
[p] = @Const0 WHERE ( [id] = @id1 )", "Updateable");
|
||||||
|
sql = Db.Updateable<NullTest>().SetColumns(it => new NullTest()
|
||||||
|
{
|
||||||
|
p2 = true
|
||||||
|
|
||||||
|
}).Where(it => it.id == 1).ToSql();
|
||||||
|
UValidate.Check(sql.Key, @"UPDATE [NullTest] SET
|
||||||
|
[p2] = @Const0 WHERE ( [id] = @id1 )", "Updateable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class NullTest
|
||||||
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
public bool? p { get; set; }
|
||||||
|
public bool p2 { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
public class UnitSaveDiary
|
public class UnitSaveDiary
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
@ -109,6 +109,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
else if (IsConst(item)&&IsConvert(item)&&UtilMethods.IsNullable(item.Type) && UtilMethods.GetUnderType(item.Type)==UtilConstants.BoolType)
|
else if (IsConst(item)&&IsConvert(item)&&UtilMethods.IsNullable(item.Type) && UtilMethods.GetUnderType(item.Type)==UtilConstants.BoolType)
|
||||||
{
|
{
|
||||||
|
item = (item as UnaryExpression).Operand;
|
||||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, GetNewExpressionValue(item)));
|
parameter.Context.Result.Append(base.Context.GetEqString(memberName, GetNewExpressionValue(item)));
|
||||||
}
|
}
|
||||||
else if (IsConst(item))
|
else if (IsConst(item))
|
||||||
|
Loading…
Reference in New Issue
Block a user