Try our conversational search powered by Generative AI!

Best way to compare Page Types?

Vote:
 
What's the preferred way to compare/ensure that a page belongs to a certain page type? Page Type IDs might change when doing import an exports. Page names might also be changed by administrators after the application has been deployed. I tried to compare the GUID instead (the GUIDs for each page type stored in appsettings) which seems to work fine. However, it looks like a PageType.Load call is needed for each comparison since there is no PageTypeGUID property on the PageData object. int ordinaryPageTypeID = PageType.Load(new Guid(ConfigurationManager.AppSettings["OrdinaryPageTypeGUID"])).ID; Is there any problems with doing this? Is the PageType.Load method cached or does this cause a database call for every comparison? I'm interested to hear if there are any other nice solutions to this problem. Thanks, Christoffer
#15759
Sep 11, 2007 11:44
Vote:
 
The answer to your question about whether PageType.Load is cached is yes, the entire list of page types are cached at the first fetching so additional loads are fetched from the cache and the page type that you requested is returned from this list.
#16295
Sep 11, 2007 16:31
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.