views:

24

answers:

1

I'm kind of new to ActiveRecord (using CastleProject) and gaining knowledge step by step. Now I'm running into another situation.

I've got a Media class that is used in some other classes: Content, Case and Service. Now when I want to delete a Media class, I want to check if there are any constraints with the previous named classes. Is there a best-practice on how to achieve this? Or are there any functions within the CastleProject/Nhibernate which might help me with this?

+1  A: 

If you just want to catch the database exception when violating a constraint, check out ISQLExceptionConverter.

But if you want to find out exactly what records in other tables will trigger the constraint exception you'll have to run whatever queries are needed yourself.

Mauricio Scheffer