LINQ-to-entities - Null reference
- by BlueRaja
I could swear this was working the other day:
var resultSet =
(from o in _entities.Table1
where o.Table2.Table3.SomeColumn == SomeProperty
select o
).First();
SelectedItem = resultSet.Table2.SomeOtherColumn;
I am getting a null reference exception on the last line: resultSet.Table2 is null.
Not only am I sure that all the foreign keys and whatnot have the correct values, but I don't see how Table2 could be null, since o.Table2.Table3.SomeColumn == SomeProperty.
resultSet is being returned with all its properties set to the correct values, with the exception that Table2 is null.