Browse Source

Update demo

SqlSugar5
sunkaixuan 2 years ago
parent
commit
5e2182c4e1
  1. 11
      Src/Asp.Net/AccessTest/Demo/Demo2_Updateable.cs
  2. 2
      Src/Asp.Net/AccessTest/Demo/Demo8_Saveable.cs

11
Src/Asp.Net/AccessTest/Demo/Demo2_Updateable.cs

@ -35,13 +35,14 @@ namespace OrmTest
/*** 1.entity or List ***/
var updateObj = new Order() { Id = 1, Name = "order1" };
//var updateObjs = new List<Order> {
// new Order() { Id = 11, Name = "order11" },
// new Order() { Id = 12, Name = "order12" }
//};
var updateObjs = new List<Order> {
new Order() { Id = 11, Name = "order11" },
new Order() { Id = 12, Name = "order12" }
};
//update all columns by primary key
var result = db.Updateable(updateObj).ExecuteCommand();//update single
var result = db.Updateable(updateObjs).ExecuteCommand();
var result2 = db.Updateable(updateObj).ExecuteCommand();//update single
//var result2 = db.Updateable(updateObjs).ExecuteCommand();//update List<Class>
//Ignore Name and Price

2
Src/Asp.Net/AccessTest/Demo/Demo8_Saveable.cs

@ -41,7 +41,7 @@ namespace OrmTest
x2.AsInsertable.ExecuteCommand();
db.Saveable(new Order() { Id = 159, Name = "jack" }).ExecuteCommand();
// db.Saveable(new Order() { Id = 159, Name = "jack" }).ExecuteCommand();
Console.WriteLine("");
Console.WriteLine("#### Saveable End ####");
}

Loading…
Cancel
Save