Eager loading property of derived class using Include

前端 未结 4 1551
我在风中等你
我在风中等你 2020-12-09 10:41

I have classes like:

Person
{
   Name
   Address
}

Employee : Person
{
   Compensation - object
}

Visitor : Person
{

}

If I write linq:<

4条回答
  •  不知归路
    2020-12-09 11:07

    You can try it this way:

    var persons = Context.Persons
                         .OfType()
                         .Include("Compensation")
                         .Concat(Context.Persons.OfType());
    

提交回复
热议问题