Пример #1
0
 /// <summary>
 /// 编辑一个对象
 /// </summary>
 /// <param name="db">实体数据</param>
 /// <param name="entity">将要编辑的一个对象</param>
 /// <param name="isAttach">是否附加到数据库上下文</param>
 public virtual T Edit(SysEntities db, T entity, bool isAttach = true)
 {
     if (isAttach)
     {
         db.Set <T>().Attach(entity);
     }
     db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
     return(entity);
 }