mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-21 10:59:56 +08:00
Optimized update single row
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user