Entity Framework - Include Multiple Levels of Properties

前端 未结 8 811
囚心锁ツ
囚心锁ツ 2020-11-22 08:43

The Include() method works quite well for Lists on objects. But what if I need to go two levels deep? For example, the method below will return ApplicationServers with the i

8条回答
  •  滥情空心
    2020-11-22 09:14

    Let me state it clearly that you can use the string overload to include nested levels regardless of the multiplicities of the corresponding relationships, if you don't mind using string literals:

    query.Include("Collection.Property")
    

提交回复
热议问题