locked
Eager Loading on a nullable foreign key is not working RRS feed

  • General discussion

  • 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

    Thursday, May 17, 2012 8:10 AM

All replies

  • What's the type of 'Country'? A primitive type or an entity?

    Go go Doraemon!

    Saturday, May 19, 2012 6:29 AM
  • It is an entity of course
    Sunday, May 20, 2012 10:48 PM