Best practice: resolving references after mirroring

Vote:
 
What is the recommended solution for the following challenge? We have a page type with a list element. The editor can define one or more source folders for the list and filtering criteria based on page types and categories. We store source folder ids as a comma sep list in a string property. Same technique is used for page type ids and category ids. After mirroring to another server the page ids are no longer valid, nor necessarily the page type ids or the category ids. How can we resolve this problem? Are there GUIDs that can be used in stead of the ids? Does the mirroring job create any kind of mapping table we could use for lookup? Thomas, Gazette
#12389
Mar 25, 2008 18:34
Vote:
 
When we export data we take the Name of categories and the Name of page types. And then on import, we map the names back to the IDs on the destination. You could use the names instead of IDs in your property if don't plan to change them. You have a DataExporter.Exporting event that allows you to prepare your data for export (static event so register in Application_Start, same goes for the Global.EPDataFactory events). The source of the event is the DataExport class which contains the pages to export in the DestinationPages collection, just modify your properties in them. You also have a DataImporter.Imported event that allows you to do post-import modifications. The source in this case will be the DataImporter class which will have properties such as DestinationPages with the imported pages and PageLookup with page ID mappings. You also have a DataImporter.ImportingPages which trigges a bit earlier in the process. You could also load the mapping object manually by calling EPiServer.Enterprise.Mirroring.MirrorLookupInfo.LoadByContext(Guid of mirroring destination), remember that this is a non-cached administrative method so use it with care (at least not on every hit on your site). That is you options to support mirroring. There is one more little trick, if you store your page IDs as HTML-alike XML you get the page mapping for free. This is recommended for multi-page properties as you get reference warnings when deleting pages in EPiServer also (we'll detect them as ordinary links). For example: Hope this helps..
#14178
Mar 25, 2008 18:44
Vote:
 
Thank you! This helps a lot. Just one follow-up question. Is the XML-link syntax independent of whether the site uses search engine friendly URLs or not? Thomas
#14179
Mar 25, 2008 18:44
Vote:
 
No, we always support both..
#14180
Mar 25, 2008 18:44
* 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.