Quantcast
Channel: User Simon_Weaver - Stack Overflow
Viewing all articles
Browse latest Browse all 116

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

$
0
0

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 all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>