Quantcast
Viewing latest article 6
Browse Latest Browse All 119

Answer by Simon_Weaver for How to determine if a related child-entity has been included

You don't need to do it through the ChangeTracker object, or manually find the entity.

Here's an example for a collection:

var isOrderItemsLoaded = MyContext.Entry(order).Collection(i => i.OrderItems).IsLoaded;

Or for a refererenced entity:

var isAddressLoaded = MyContext.Entry(order).Reference(i => i.Address).IsLoaded;

Note: when a collection is not yet loaded it will be an empty array and not null.


Viewing latest article 6
Browse Latest Browse All 119

Trending Articles