Update Expression analysis

This commit is contained in:
sunkaixuan
2017-07-11 23:56:06 +08:00
parent 8c1a34b708
commit 6531d80459
3 changed files with 42 additions and 2 deletions

View File

@@ -124,6 +124,25 @@ namespace OrmTest.UnitTest
t10.Value,
"Update 10 error"
);
var t11 = db.Updateable<DataTestInfo>().UpdateColumns(it => new DataTestInfo() { Datetime1=DateTime.MaxValue }).Where(it => it.Int1 == 11).ToSql();
base.Check(@"UPDATE [DataTestInfo] SET
[Datetime1] = @constant0 WHERE ( [Int1] = @Int11 )", new List<SugarParameter>() {
new SugarParameter("@Int11",11),
new SugarParameter("@constant0",DateTime.MaxValue) },
t11.Key,
t11.Value,
"Update 11 error"
);
var t12 = db.Updateable<DataTestInfo>().UpdateColumns(it => new DataTestInfo() { Int2 = it.Int2+1 }).Where(it => it.Int1 == 11).ToSql();
base.Check(@"UPDATE [DataTestInfo] SET
[Int2] = ( [Int2] + @Const0 ) WHERE ( [Int1] = @Int11 )", new List<SugarParameter>() {
new SugarParameter("@Int11",11),
new SugarParameter("@Const0",1) },
t12.Key,
t12.Value,
"Update 12 error"
);
}
public SqlSugarClient GetInstance()