我这里是不修改创建时间,和创建人 ..其它的都修改.
DbEntityEntry<JF_Tasks> entry = db.Entry<JF_Tasks>(jf_tasks);
entry.State = EntityState.Modified; //全更新 entry.Property(a => a.CreatedOn).IsModified = false; //设置不更新的值 entry.Property(a => a.CreatedBy).IsModified = false; await db.SaveChangesAsync();
只修改删除标记
message.isdelete = true;
DbEntityEntry<message> entry = db.Entry(message);
entry.State = EntityState.Unchanged; //全不更新
entry.Property(m => m.isdelete).IsModified = true; //设置要更新的属性