This commit is contained in:
sunkaixuan
2023-05-21 18:13:43 +08:00
parent 335f9bd690
commit 45ff6d39ff
3 changed files with 22 additions and 5 deletions

View File

@@ -53,10 +53,17 @@ namespace OrmTest
//If there is no primary key
var result5 = db.Updateable(updateObj).WhereColumns(it => new { it.Id }).ExecuteCommand();//update single by id
var result6 = db.Updateable(updateObjs).WhereColumns(it => new { it.Id }).ExecuteCommand();//update List<Class> by id
var list = db.Queryable<Order>().OrderBy(it => it.Id).Take(2).ToList();
if (list.Count >= 2)
{
list[0].Price = 10;
list[1].Price = 2;
var result69 =
db.Updateable(list)
.PublicSetColumns(it => it.Price, "+")
.ExecuteCommand();
}
/*** 2.by expression ***/
//update name,createtime