I'm a developer using EpiServer CMS 5R2 on a new project. I've been tasked with creating a CustomPageProvider to link to an existing back end store which we don't have control of. However looking at the sample provider (XmlPageProvider) it appears that the provider is responsible for maintaining the meta information that EpiServer needs for example (from the examples.xml document):
<page id="10011" parent="10010" pagetypeid="3" versionid="1" security="Everyone:Read;Administrators:Create,Edit"> <property name="PageGUID">35a988fe-2bc1-4e45-a41f-3a009a660551</property> <property name="PageTypeID">3</property> <property name="PageWorkStatus">4</property> <property name="PageFolderID">118</property> <property name="PageTypeName">[Public] Standard page</property> <property name="PageMasterLanguageBranch">en</property> <property name="PageLanguageBranch">en</property> <!---- SNIP! ----> <! ----- Actual content I think---> <property name="Heading">A subpage</property> <property name="MainBody"><p>an external subpage</p></property> <property name="SecondaryBody"><p>second body</p></property> <property name="MetaAuthor">John Doe</property> </page>
I'm a little concerned by this as I would prefer EpiServer takes care of this. This is a high volume website and it would be nice if my services didn't have to contain an extra data store in order to maintain this information, there will be cacheability concerns to say the least.
1. Is a custom page provider the right tool for the job?
2. If so, is there a way to push this responsibility back onto EpiServer?
3. If not, can you give me any recommendations on how best to approach storing this data? As it is over and above what will be coming from our data source.
You do not have to store any meta information in your backend storage. There is helper methods in PageProviderBase, e.g. InitializePageData (sets metadata properties) and SetPropertyValues (sets meta and/or custom proeprties) that helps you with initialization of PageData objects.
So the answers to your questions:
1. It sounds like PageProvider could fit well for your purpose.
2. Use InitializePageData to handle MetaDatas (InitializePageData will set default values for meta properties e.g. status to published and so on). If you however want to set dome other meta data property value than the default ones e.g. status (Publish etc.) you can do that by calling SetPropertyValues afterwards.
3. If additional data needs to be stored outside backing storage there are several options for this (custom table in db, filebased etc.). Which one to use is dependent on your environment, type of data to store etc.
Thankyou, that's clarified a lot of things for me!
I think I was confused by the way the sample is layed out. The documentation on Custom Page Providers is a little sparse isn't it?