This is a common repository delete function. How does C# know which item to delete? Isn't it better to delete by integer ids, primaryid keys? By passing the whole class, does it not taking longer processing time ?
Thanks,
public void Delete(T entity)
{
_dbContext.Set<T>().Remove(entity);
_dbContext.SaveChanges();
}
public void Delete(Foo entity)
{
context.Foos.Remove(entity);
}