增加更新操作测试代码

This commit is contained in:
Kenton 2025-03-10 17:12:31 +08:00
parent 6a489b4cb4
commit 8bb6e94fd1
2 changed files with 11 additions and 1 deletions

View File

@ -124,6 +124,15 @@ namespace DB2CoreTest.CURD
}).OrderBy(ui => ui.UserName).ToList(); }).OrderBy(ui => ui.UserName).ToList();
} }
public static void Updateable()
{
// 获取新的数据库实例
var db = DbHelper.GetNewDb();
//更新用户
var ret = db.Updateable<UserInfo>(p => p.UserName == "test").Where(p => p.UserName == "admin").ExecuteCommand();
}
public static void Deleteable() public static void Deleteable()
{ {
// 获取新的数据库实例 // 获取新的数据库实例

View File

@ -5,13 +5,14 @@ public class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
CodeFirst.Init(); //CodeFirst.Init();
CodeFirst.Insertable(); CodeFirst.Insertable();
CodeFirst.Queryable(); CodeFirst.Queryable();
CodeFirst.JoinQuery(); CodeFirst.JoinQuery();
CodeFirst.PageQuery(); CodeFirst.PageQuery();
CodeFirst.OrderBy(); CodeFirst.OrderBy();
CodeFirst.GroupBy(); CodeFirst.GroupBy();
CodeFirst.Updateable();
CodeFirst.Deleteable(); CodeFirst.Deleteable();
} }
} }