I have a EDM that was wizard generated from an SQL 2005 Express database. For example, I have a table named Projects with a relationship to a table named People. Projects have two relationships on the People table primary key as foreign key in the People table (ChamipionID and LeaderID).
I have cleaned up all of the names for the Entities, Entity Sets and Associations and verified that the Association mappings are what I expect them to be.
When I write a Linq to Entities query against this, the association "Leader" which is mapping LeaderID to PeopleID of data type int64 (long) is always returned as null in the View Model in an MVC 1 website.
for example
var object = (from p in _entities.Projects
where p.Leader.PeopleID == 1
select p);
always yeilds null for object.Leader even though the association allowed for the filtering to happen correctly and the project data is all there.
even if I write the query like this..
var object = (from p in _entities.Projects
from pe in _entities.PeopleSet
where pe.PeopleID == 1
select p);
the result is the same
does anyone know why this happens? What am I missing?