Optimized update single row

This commit is contained in:
sunkaixuan
2017-11-01 20:31:45 +08:00
parent e3d1955a53
commit 7b015209c0
3 changed files with 20 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ namespace OrmTest.Demo
//Only update Name
var t3 = db.Updateable(updateObj).UpdateColumns(it => new { it.Name }).ExecuteCommand();
var t3_1 = db.Updateable(updateObj).UpdateColumns(it => it=="Name").ExecuteCommand();
var t3_1 = db.Updateable(updateObj).UpdateColumns(it => it == "Name").ExecuteCommand();
//Ignore Name and TestId
@@ -60,8 +60,11 @@ namespace OrmTest.Demo
db.Updateable(updateObj).Where(true).ExecuteCommand();
var t12= db.Updateable<School>().AS("Student").UpdateColumns(it => new School() { Name = "jack" }).Where(it => it.Id == 1).ExecuteCommandAsync();
var t12 = db.Updateable<School>().AS("Student").UpdateColumns(it => new School() { Name = "jack" }).Where(it => it.Id == 1).ExecuteCommandAsync();
t12.Wait();
//update one columns
var count= db.Updateable<Student>().UpdateColumns(it => it.SchoolId == 1).Where(it => it.Id == 1).ExecuteCommand();
}
}
}