/// <summary> /// DBからのファイル情報削除 /// </summary> /// <param name="id"></param> /// <remarks>トランザクションは管理しない</remarks> private Model.File removeFromDB(string id, DbConnection conn) { Model.File removedFile = null; using (var entities = new Model.FlowerEntitiesEx(conn, false)) { var target = (from e in entities.Files.AsEnumerable() where e.ID == id select e); if (target != null && target.Count() > 0) { removedFile = entities.Files.Remove(target.ElementAt(0)); entities.SaveChanges(); } } return(removedFile); }
/// <summary> /// DBからのファイル情報削除 /// </summary> /// <param name="id"></param> /// <remarks>トランザクションは管理しない</remarks> private Model.File removeFromDB(string id, DbConnection conn) { Model.File removedFile = null; using (var entities = new Model.FlowerEntitiesEx(conn, false)) { var target = (from e in entities.Files.AsEnumerable() where e.ID == id select e); if (target != null && target.Count() > 0) { removedFile = entities.Files.Remove(target.ElementAt(0)); entities.SaveChanges(); } } return removedFile; }