/// <summary>
 /// 编辑一个对象
 /// </summary>
 /// <param name="db">实体数据</param>
 /// <param name="entity">将要编辑的一个对象</param>
 /// <param name="isAttach">是否附加到数据库上下文</param>
 public virtual T Edit(LYProjectEntities db, T entity, bool isAttach = true)
 {
     if (isAttach)
     {
         db.Set <T>().Attach(entity);
     }
     db.SaveChanges();
     return(entity);
 }
 /// <summary>
 /// 提交保存,持久化到数据库
 /// </summary>
 /// <param name="db">实体数据</param>
 /// <returns>受影响行数</returns>
 public int Save(LYProjectEntities db)
 {
     return(db.SaveChanges());
 }