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.
精彩评论