does class/object models have a out-of-the-box equivalent to a database foreign key constraint
Posted
by Greg
on Stack Overflow
See other posts from Stack Overflow
or by Greg
Published on 2010-05-06T23:30:19Z
Indexed on
2010/05/06
23:38 UTC
Read the original article
Hit count: 164
Hi,
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) object 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?
© Stack Overflow or respective owner