Assume I have a two tables, A and B. Table A has a primary Key called A_ID of type int, and table B has a foreign key called A_ID.
When I add the two tables to a Linq To SQL data context class it correctly creates the classes and the association between them.
My question is, class B will have a property of type int called A_ID. It will also have property called A, of type A.
Now, if at runtime, I make a linq to sql call which populates an instance of B, B.A_ID and B.A.A_ID will be the same value. What is stopping a developer from making some mistake and putting a different value in B.A_ID than is in B.A.A_ID. In a database you couldn't do this because of the foreign key constraints, but how do the Linq to sql classes enforce those constraints on the client side?