public static void DeleteScCompInfoWithoutSelect() { var comp = new ScCompInfo { CompSn = 30 }; using (var db = new WebDbContext()) { //db.ScCompInfoes.Attach(comp); //db.ScCompInfoes.Remove(comp); db.Entry(comp).State = System.Data.Entity.EntityState.Deleted; try { db.SaveChanges(); } catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); } } }