Try our conversational search powered by Generative AI!

PagePath column value from tblPage

Vote:
 

Each row in tblPage has a value in the PagePath column that represents the IDs of its ancestors. Is there any way I can get hold of this using the API? I was hoping that the PagePath type might be the way to get  to it but apparently not, unless I am using it incorrectly.

#49788
Mar 31, 2011 16:56
Vote:
 

Just "crawl" the page tree using the ParentLink of each page to construct the page path. Unless you do it on an exceptional scale it will be a very cheap operation performance-wise.

#49789
Mar 31, 2011 18:07
Vote:
 

I'm already doing that, Magnus - I just wondered if there might be a better way to walk up the tree than having to hydrate a pagedata from each page's parentlink in order to get the parent's parent. If that's as cheap as you say then I'll stick with it. Most of it will be cached anyway.

 

I'm still wondering if there's anyway I can get hold of that PagePath data through the API, though!

#49799
Edited, Apr 01, 2011 9:31
Vote:
 

There is a method DataFactory.Instance.GetParents that will give you a PagePath instance. However that API is uncached (for the LocalPageProvider at least) so I would suggest Magnus approach in most cases. 

#49802
Apr 01, 2011 11:58
Vote:
 

Thanks, Johan. That's exactly the info I was looking for.

#49804
Edited, Apr 01, 2011 12:13
Vote:
 

Hi Johan,

Is there any reason why the GetParents is not cached? Finally I thought I found a way to avoid crawling of the page tree...

#49910
Apr 05, 2011 14:29
Vote:
 

The reason we do not cache it for now is that if we cached it we should have a strategy/algorithm implemented for when to evict the items from cache. That is something that we might add in future but that is not in place now.

#49911
Apr 05, 2011 14:34
Vote:
 

Hi Johan,

thanks for your answer! I use this GetParents to find out which segment a user is in when navigating the site. For each request i use GetParents. Is this potentially dangerous for performance?

#49914
Apr 05, 2011 14:54
Vote:
 

It is often hard to give a straigth answer when it comes to performance. My advice would be to measure it. You could e.g. first do some measurement with your implementation and then compare it with an implementation that traverse parent chain. Remember though that the first time parent chain is walked might take more time due to cache misses. 

#49915
Apr 05, 2011 15:01
Vote:
 

Hi Johan,

I will check that out. Thanks!

#49916
Apr 05, 2011 15:04
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.