Update exp to sql

This commit is contained in:
sunkaixuan
2019-05-28 15:31:18 +08:00
parent 5b481ce909
commit eaa4472274
5 changed files with 56 additions and 16 deletions

View File

@@ -15,9 +15,19 @@ namespace OrmTest
Db.DbMaintenance.TruncateTable<SYS_USER>();
Db.Insertable(new SYS_USER() { USER_ID=1,USER_ACCOUNT = "a", USER_PWD = "b", USER_NAME = "c", PWD_LASTCHTIME = DateTime.Now, PWD_ERRORCOUNT = 1, PWD_LASTERRTIME = DateTime.Now }).ExecuteCommand();
Db.Updateable(new SYS_USER() { USER_ID=1, PWD_LASTERRTIME = null }).WhereColumns(it=> new{ it.PWD_ERRORCOUNT, it.PWD_LASTERRTIME }).ExecuteCommand();
Db.CodeFirst.InitTables(typeof(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 => it.BoolValue == !it.BoolValue ).Where(it=>it.Id==1).ExecuteCommand();
}
}
public class BoolTest
{
public int Id { get; set; }
public bool BoolValue { get; set; }
}
/// <summary>
/// 普通用户表
/// </summary>