Browse Source

Update Demo

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
f338385485
  1. 18
      Src/Asp.Net/SqlServerTest/Program.cs
  2. 5
      Src/Asp.Net/SqlServerTest/UnitTest/Updateable.cs

18
Src/Asp.Net/SqlServerTest/Program.cs

@ -8,17 +8,17 @@ namespace OrmTest
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
// OldTestMain.Init(); //OldTestMain.Init();
//Demo //Demo
//Demo0_SqlSugarClient.Init(); Demo0_SqlSugarClient.Init();
//Demo1_Queryable.Init(); Demo1_Queryable.Init();
//Demo2_Updateable.Init(); Demo2_Updateable.Init();
//Democ_GobalFilter.Init(); Democ_GobalFilter.Init();
//DemoD_DbFirst.Init(); DemoD_DbFirst.Init();
//DemoE_CodeFirst.Init(); DemoE_CodeFirst.Init();
//Demo5_SqlQueryable.Init(); Demo5_SqlQueryable.Init();
//Demo6_Queue.Init(); Demo6_Queue.Init();
//Unit test //Unit test
NewUnitTest.Init(); NewUnitTest.Init();

5
Src/Asp.Net/SqlServerTest/UnitTest/Updateable.cs

@ -18,8 +18,11 @@ namespace OrmTest
Db.CodeFirst.InitTables(typeof(BoolTest)); Db.CodeFirst.InitTables(typeof(BoolTest));
var x = new BoolTest(); var x = new BoolTest();
Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = !it.BoolValue }).Where(it=>it.Id==1).ExecuteCommand(); Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = !it.BoolValue }).Where(it=>it.Id==1).ExecuteCommand();
Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == !it.BoolValue ).Where(it=>it.Id==1).ExecuteCommand(); Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == !it.BoolValue ).Where(it=>it.Id==1).ExecuteCommand();
Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand();
Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand();
Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand();
Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand();
} }
} }

Loading…
Cancel
Save