Eager Loading on a nullable foreign key is not working
-
Thursday, May 17, 2012 8:10 AM
HI folks
I am having trouble eager loading a related table that has a nullable foreign key.
Here is my entities and their relationships:
Details.Language(not NULLable) ->Language
Details.Country(NULLable) ->Country
Language works
Country doesn't
I have tried Includes:
Details.Include("Language") /*Language loads */
Details.Include("Country") /*Country doesn't load */
Details.Include("Country").Include("Language") /*Country doesn't load Language does */
I have tried projection:
Details.Select(cd => new {
Details = cd,
language = cd.Language,
country = cd.Country
} )
I haven't tried Load() ('cause I can't get the syntax right)var e= CompanyDetails.Select(cd => cd); e.Language.Load() /* errors*/
Has any body got a clue why NULLable relationships won't load?
regards
GregJF

