I have an application with a database that doesn't allow cascading deletes. When a user goes to delete an entity, I would like to display a popup saying something generic like, "This record has dependencies that must be deleted first".
To support this, I was hoping to write some code that could generically take an entity, check for virtual properties, and if they exist, iterate through them to see if any records exist. If it finds one, it would immediately return true.
The goal would be to return a true/false with as little lazy loading as possible.
Before I write the code to do this, just wanted to see if anyone has done this before. I guess I could just look for the exception, but I generally don't like coding for exceptions.