I am wondering if there is any way in LINQ to SQL to have two tables point to one another's ids, such that there is a 1:1 relationship between them, and to create both of the objects with a single SubmitChanges.
For example, if I have one class Car, with properties CarExtension and CarExtensionID that point to a CarExtension object, and the CarExtension class in turn has Car and mandatory CarID properties that point back to the Car table, is there a way to set this up so that I can create a Car object, create a new CarExtension and assign it to the Car.CarExtension property, and then successfully submit changes?
Currently the SubmitChanges fails because LINQ to SQL doesn't know to assign the id of the newly created car to the .CarID property of the CarExtension, so then when it tries to create the CarExtension the creation fails since the required CarID field is blank.
CarExtension's primary key should also be the foreign key toCar. It shouldn't have a separateCarIDas FK. - Gert Arnold