开发者

does class/object models have a out-of-the-box equivalent to a database foreign key constraint

Does does class/object models have a out-of-the-box equivalent to a database foreign key constraint? Assume the language is C# please.

That is say Class A has a field that references Class B and vica-versa. If I have Object A & B (instantiated from these classes) what happens if I delete Object B? Does it auto-delete or throw a constraint issue if it still exists in Object A as a reference?

That is, for this scenario is there a way to ensure when a Object A is delete that either (a) o开发者_高级运维bject B is delete like a cascade delete, or (b) a constraint exception is thrown as the expectation is that the reference in Class B should be non-null?


Per se, no. Foreign key is property of some DBMSs. But you can simulate this in a lot of ways in an object oriented arquitecture.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜