LLBLGen Pro 2.5
SelfServicing
I'm trying to find a method to override (or any other means) to block an entity from being deleted.
I've tried overriding:
- OnValidateEntityBeforeDelete
- OnDelete
- OnAuditDeleteOfEntity
But it seems the only way to block the deletion from happenning is to intentionally throw an Exception in one of those (OnValidateEntityBeforeDelete, I think is the one that worked for me). Obviously, I'd prefer a cleaner way. For example: A lot of events in .NET can be blocked in the event handler by setting the Cancel property of the EventArgs to false like so:
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
e.Cancel = false; //Don't let the delete happen.
}
In case I'm going about this the wrong way, what I'm trying to ultimately accomplish is to have a stored procedure called instead of a direct delete. Perhaps overriding one of the delete events is the wrong path?
TIA