Есть ли способ определить, удаляется ли запись объекта успешно? Пожалуйста, смотрите код и комментарии ниже.
var myProductID = 123;
var productToDelete = await db.Products.Where(p => p.ID == myProductID).FirstOrDefaultAsync();
if (productToDelete != null)
{
db.Entry(productToDelete).State = EntityState.Deleted;
await db.SaveChangesAsync();
}
// At this point, is there a way to check whether the delete operation went thru successfully? In other words, I want to check if the record really got deleted from the database. I could run a re-query, but I don't want to do that.
Я использую. NET 4.7.2, ASP. NET MVC 5 и Entity Framework 6.