I have table A and Table B.
Table B contains two columns, Name and ID.
Table A contains several columns and a foreign key column pointing to B.ID called B_ID
On the client side, I have all the data I want to insert into Table A, except for B_ID. I have B.Name though.
using link to sql I need to retrieve the id in table B based on the value of Name. If the record does not exist I need to insert it and get back the ID (which is an identity column).
Now that I have B.ID, I then have to insert record in table A.
I've built my data context class by importing tables A and B in the designer, I'm just not sure how to go about writing the linq to sql statements here.