А
private void SoftDeleting()
{
ChangeTracker.DetectChanges();
// fix trackable entities
var markedAsDeleted = ChangeTracker.Entries<ISoftDeletable>().Where(x => x.State == EntityState.Deleted);
foreach (var item in markedAsDeleted)
{
// Set the entity to unchanged (if we mark the whole entity as Modified, every field gets sent to Db as an update)
item.State = EntityState.Unchanged;
// Only update the IsDeleted flag - only this will get sent to the Db
item.Entity.IsDeleted = true;
}
}