DoomerDGR8
DoomerDGR8

Reputation: 5042

EF6 Including references of Collections in Entity

I'm setting up a context to be read as follows:

enter image description here

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

How do I include that entity on each BILL_INFO_DETAIL?

Upvotes: 1

Views: 98

Answers (2)

Arfizur Rahman
Arfizur Rahman

Reputation: 394

If I understood you correctly. Maybe what you want is the ThenInclude()

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

Upvotes: 1

talesa82035
talesa82035

Reputation: 124

Maybe you can just use ,if there is navigation properties in table(BILL_INFO_DETAI):

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

reference:https://learn.microsoft.com/zh-tw/ef/ef6/querying/related-data

Upvotes: 1

Related Questions