Testing for prefetch paths

Posts   
 
    
Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 03-Aug-2005 23:19:23   

You've probably answered this before Frans, but I can't find it on search.

Here it is: using adapter, how do you test an entity to determine whether or not a relation was called with the prefetchPath? I need to differentiate between a EntityCollection.Count = 0 and a related EntityCollection that was never retrieved in the first place.

Thanks!

Jeff

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 04-Aug-2005 11:07:12   

You can't. The objects in memory represent a subset of the real entities in the database. This means that when you fetch for entity E a subset of the related entities R, this may lead to 0 entities being fetched. Though there might be entities R in the database, though they didn't match the filter being set for the particular fetch for R.

Also, after your fetch, some other user might have added an entity which thus is present, though not in memory of your process.

Frans Bouma | Lead developer LLBLGen Pro