Entity Framework - Inheritance with .Include?

前端 未结 4 1507
挽巷
挽巷 2021-01-02 09:05

I think that there\'s a similar post on here about this but not exactly the same...

I have two entities in my EF model - let\'s call them Person and Developer, with

4条回答
  •  天命终不由人
    2021-01-02 09:20

    Based on Tri Q's answer, but for the ones that prefer the '.Load()' approach, you can use:

    context.Persons.OfType().Include(t => t.Qualifications).Load();
    

    I use it inside my DbContext. I created LoadDb() method, that loads all the data I need. So I can use it from many projects.

提交回复
热议问题