Why would it ignore a prefetch?

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 24-Sep-2017 20:31:01   
            var adapter = new DataAccessAdapter();

            var entity = new ChaletAccountEntity { AccountId = accountId };

            var path = new PrefetchPath2(EntityType.ChaletAccountEntity);
            path.Add(ChaletAccountEntity.PrefetchPathChaletInstance.SubPath.Add(ChaletInstanceEntity.PrefetchPathChalet));
            path.Add(ChaletAccountEntity.PrefetchPathVwEventAccount.SubPath.Add(
                    VwEventAccountEntity.PrefetchPathEvent));

            adapter.FetchEntity(entity, path);

ChaletInstance and VwEventAccount are both null and the generated code doesn't even look for them. How could this be?

Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 24-Sep-2017 20:41:07   
var adapter = new DataAccessAdapter();

            var entity = new ChaletAccountEntity { AccountId = accountId };

            var path = new PrefetchPath2(EntityType.ChaletAccountEntity);
            path.Add(ChaletAccountEntity.PrefetchPathChaletInstance).SubPath.Add(ChaletInstanceEntity.PrefetchPathChalet);
            path.Add(ChaletAccountEntity.PrefetchPathVwEventAccount).SubPath.Add(
                    VwEventAccountEntity.PrefetchPathEvent);

            adapter.FetchEntity(entity, path);

A warning message would be helpful for the first post's code!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 25-Sep-2017 13:45:31   

thing is, it can't detect that, as it adds itself to a path node in the first code too, it's just that the path node it is added to is not added to something. How would you detect that? It simply goes out of scope. Mind you it is possible to build paths that way (add subpaths to nodes which later on are added to path nodes) so you can't say 'the subnode is added to a node which isn't in a path-> bad'.

Frans Bouma | Lead developer LLBLGen Pro