public void Update(TEntity entit) { //更新:先查找到要更新的实体,然后在覆盖原有的 dbSet.Attach(entit); //需要修改状态 dbcontext.Entry(entit).State = EntityState.Modified; }
public void Update(TEntity tEntity) { // throw new NotImplementedException(); //先查找要更新额实体,然后在覆盖原有的 dbset.Attach(tEntity); ws.Entry(tEntity).State = EntityState.Modified; }
public void Update(TEntity Tentity) { _dbSet.Attach(Tentity); _dbContext.Entry(Tentity).State = EntityState.Modified;//修改实体状态 }
public void Update(TEntity tEntity) { _dbSet.Attach(tEntity); //更改实体的状态为已修改 _dbContext.Entry(tEntity).State = EntityState.Modified; }