public void Delete(TEntity entity) { if (_context.GetState(entity) == EntityState.Detached) { _dbset.Attach(entity); } _dbset.Remove(entity); }