Update Demo

This commit is contained in:
sunkaixuan 2019-05-20 20:10:21 +08:00
parent 438cf9504a
commit f802407db4
3 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,7 @@
namespace OrmTest
{
public class CarType
{
public bool State { get; set; }
}
}

View File

@ -145,6 +145,7 @@
<Compile Include="OldTest\UnitTest\Setting\MapColumn.cs" />
<Compile Include="OldTest\UnitTest\Setting\MapTable.cs" />
<Compile Include="OldTest\UnitTest\Update.cs" />
<Compile Include="Models\CarType.cs" />
<Compile Include="UnitTest\UAdo.cs" />
<Compile Include="UnitTest\UQueryable.cs" />
<Compile Include="UnitTest\UQueryableAsync.cs" />

View File

@ -16,6 +16,11 @@ namespace OrmTest
var totalPage = 0;
var list=Db.Queryable<Order>().ToPageList(pageindex, pagesize, ref total, ref totalPage);
Db.CodeFirst.InitTables(typeof(CarType));
Db.Updateable<CarType>()
.SetColumns(it => new CarType { State =SqlSugar.SqlFunc.IIF(it.State==true,false,true) }).Where(it=>true)
.ExecuteCommand();
}
}
}