Checking for dependents

Posts   
 
    
llbl1234
User
Posts: 1
Joined: 01-Mar-2011
# Posted on: 01-Mar-2011 02:50:02   

Does LLBLGen have the ability to tell you if your entity has dependents?

For example, I have a customer table and an order table with a FK pointing back to the customer table. If I want to delete a customer, is there a way to check for dependents before it gets to the database and throws a reference constraint exception? I'd like to avoid unnecessary trips to the db.

Thanks in advance for any help.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-Mar-2011 08:37:01   

If the order entity was not loaded already and asociated with the customer entity in memory, there will be no way to check for it without visiting the database.

IMHO, visiting executing the delete and receiving a FK violation exception is the perfect solution.