Prefetch Path

Posts   
 
    
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 05-Apr-2007 22:18:00   

Hi All,

I have the following prefetch code:

        PrefetchPath.Add(DistrictEntity.PrefetchPathDistrictUser, 0, New PredicateExpression(DistrictUserFields.UserName = userName)) _
        .SubPath.Add(DistrictUserEntity.PrefetchPathDeptSetUser) _
        .SubPath.Add(DeptSetUserEntity.PrefetchPathDeptSetUserJob) _
        .SubPath.Add(DeptSetUserJobEntity.PrefetchPathJob) _
        .SubPath.Add(JobEntity.PrefetchPathJobApp) _
        .SubPath.Add(JobAppEntity.PrefetchPathApplication, 0, New PredicateExpression(ApplicationFields.ApplicationId = applicationId))

It works fine. Want I want to add is another path that goes from DeptSetUser to DeptSet it has a n:1 relationship so I should be able to access the entity using DeptSetUser(n).DeptSetEntity

Any help would be great.

Thanks,

FIshy

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Apr-2007 10:44:38   
PrefetchPathElement2 prefetchPathElement = DistrictUserEntity.PrefetchPathDeptSetUser; 
        
prefetchPathElement.SubPath.Add(DeptSetUserEntity.PrefetchPathDeptSetUserJob) _
        .SubPath.Add(DeptSetUserJobEntity.PrefetchPathJob) _
        .SubPath.Add(JobEntity.PrefetchPathJobApp) _
        .SubPath.Add(JobAppEntity.PrefetchPathApplication, 0, New PredicateExpression(ApplicationFields.ApplicationId = applicationId));

prefetchPathElement.SubPath.Add(DeptSetUserEntity.PrefetchPathDeptSet);

 PrefetchPath.Add(DistrictEntity.PrefetchPathDistrictUser, 0, New PredicateExpression(DistrictUserFields.UserName = userName)).SubPath.Add(prefetchPathElement );
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 06-Apr-2007 17:17:58   

Walaa wrote:

PrefetchPathElement2 prefetchPathElement = DistrictUserEntity.PrefetchPathDeptSetUser; 
        
prefetchPathElement.SubPath.Add(DeptSetUserEntity.PrefetchPathDeptSetUserJob) _
        .SubPath.Add(DeptSetUserJobEntity.PrefetchPathJob) _
        .SubPath.Add(JobEntity.PrefetchPathJobApp) _
        .SubPath.Add(JobAppEntity.PrefetchPathApplication, 0, New PredicateExpression(ApplicationFields.ApplicationId = applicationId));

prefetchPathElement.SubPath.Add(DeptSetUserEntity.PrefetchPathDeptSet);

 PrefetchPath.Add(DistrictEntity.PrefetchPathDistrictUser, 0, New PredicateExpression(DistrictUserFields.UserName = userName)).SubPath.Add(prefetchPathElement );

Thanks. I haven't tried your code but it looks reasonable.

Just a comment about your documentation. I did a search on 'prefetchPathElement' and found references to it but no example code using it. You may want to add some examples.

Thanks again,

Fishy

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 06-Apr-2007 18:17:03   

In general, you should be able to get things up and running with the reference manual in hand in this case. Did you try the reference manual about prefetchpathelement ?

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 06-Apr-2007 19:51:40   

Otis wrote:

In general, you should be able to get things up and running with the reference manual in hand in this case. Did you try the reference manual about prefetchpathelement ?

No, I just looked into the Users Manual. Which, by the way, you did an excelent job simple_smile . It's just that the prefetchpathelement was discussed in the User Manual but no examples of it was present.

Thanks for everything.

Fishy