public void 根据主键ID更新整个实体lt() { var model = DBSqlite <LockPers> .Select().Column().From().Where(p => p.Name == "测试bool修改2 xxxxxx").ExecuteQuery <LockPers>().FirstOrDefault(); model.Content = "棉花棉花棉花棉花棉花"; model.ContentOld = "忽略Write(false)标记字段"; model.Prompt = "xxxxxxxxxxx"; var issucs = DBSqliteFuncs.New.Updat <LockPers>(model); Console.WriteLine(issucs); }
public void 先查再修改指定字段() { LockPers p = new LockPers() { Id = "028e7910-6431-4e95-a50f-b9190801933b" }; var query = DBSqlite <LockPers> .Select().Column(c => new { c.Content, c.EditCount }).From().Where(m => m.Id == p.Id); var old = query.ExecuteQuery <LockPers>().FirstOrDefault(); old._IsWriteFiled = true; // 标记开始记录赋值字段 注意上面查询LockPers 要再默认构造函数里把 标识改为false 查出的数据不要记录赋值字段 old.Name = "蛋蛋蛋蛋H$E22222"; old.Prompt = "好多多读都多大"; old.UpdateTime = DateTime.Now; var id = old.Id; var t = DBSqliteFuncs.New.Update <LockPers>(old, w => w.Id == p.Id); }