简体   繁体   English

EF6 在实体中包括 Collections 的引用

[英]EF6 Including references of Collections in Entity

I'm setting up a context to be read as follows:我正在设置一个上下文,如下所示:

在此处输入图像描述

Now, the last include is a collection and each entity in that collection has a relation (1-to-1) to an entity called SERVICE_INFO现在,最后一个包含是一个集合,该集合中的每个实体都与一个名为SERVICE_INFO的实体有一个关系(一对一)

How do I include that entity on each BILL_INFO_DETAIL ?如何在每个BILL_INFO_DETAIL中包含该实体?

Maybe you can just use,if there is navigation properties in table(BILL_INFO_DETAI):如果表中有导航属性(BILL_INFO_DETAI),也许你可以使用:

   Include( i=> i.BILL_INFO_DETAIL.SELECT( b => b.SERVICE_INFO ));

reference: https://docs.microsoft.com/zh-tw/ef/ef6/querying/related-data参考: https://docs.microsoft.com/zh-tw/ef/ef6/querying/related-data

If I understood you correctly.如果我理解正确的话。 Maybe what you want is the ThenInclude()也许你想要的是ThenInclude()

.Include( i=> i.BILL_INFO_DETAIL).ThenInclude(b => b.SERVICE_INFO)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM