Update Demo

This commit is contained in:
sunkaixuan 2019-05-28 16:12:59 +08:00
parent cb954fbf4b
commit f338385485
2 changed files with 13 additions and 10 deletions

View File

@ -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();

View File

@ -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();
} }
} }