LINQ weak relation between tables

Posted by cleric on Stack Overflow See other posts from Stack Overflow or by cleric
Published on 2010-04-01T16:33:59Z Indexed on 2010/04/01 16:43 UTC
Read the original article Hit count: 495

Filed under:

I have two tables with a weak relation. I need get a text value from one table using a key from another. I am using the following C# LINQ code:

City = rea.tRealEstateContact.tPostnumre != null ? rea.tRealEstateContact.tPostnumre.Bynavn : string.Empty

But when the key cannot be found in the table 1(tPostnumre), an exception is thrown.

How should I do this?

© Stack Overflow or respective owner

Related posts about linq-to-sql