开发者

ActiveRecord: how to find constraints?

开发者 https://www.devze.com 2023-01-06 19:05 出处:网络
I\'m kind of new t开发者_Python百科o ActiveRecord (using CastleProject) and gaining knowledge step by step.

I'm kind of new t开发者_Python百科o 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消