none
entity Framework : Using Include() for more than 1 level RRS feed

  • Question

  • Hello !

    When use the Include() like this :

    context.myobjs.Include(Function(t2) t2.ch1.ch2.ch3)

    only ch3 is loaded or both ch1 , ch2 and ch3 ?

    Thank you !

    Friday, February 13, 2015 1:55 AM

Answers

  • Hello,

    It is not clear that what the relational hierarchy of these entities are, if they are myjobs associates with ch1 and ch1 associates with ch2 and ch2 associates with ch3, then you could check the generated sql statement by using:

    db.Database.Log = Sub(val) Console.Write(val)

    In my side, for such a scenario, the generated sql include all tables which means ch1 , ch2 and ch3 are all loaded.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, February 16, 2015 9:19 AM
    Moderator