public void Delete(TEntity entityToDelete) { if (DbCxt.Entry(entityToDelete).State == EntityState.Detached) { DbSet.Attach(entityToDelete); } DbSet.Remove(entityToDelete); }