Try our conversational search powered by Generative AI!

Creating page types in code for existing pages

Vote:
 

I just migrated from CMS 6 R2 to 7.1 and want to define the page types in code. Currently all page types are defined in the database only.

When I define a page type I need to connect it to the already defined page type in the database. I assume this is done by using the attribute ContentType.GUID. This would work well on our development site. But in test and production the GUID will differ. Any suggestions on the best approach for this problem?

#71545
May 22, 2013 13:13
Vote:
 

Why dont you get a fresh database backup from production and restore it to your development db. Then you start define pagetypes. You are correct that you use the GUID property on the ContentType attribute. Ex;

[ContentType(DisplayName = "Startpage",
      GUID = "9a269a35-e044-448a-9dbb-0e7085087489"
    )]
    [AvailablePageTypes(Include = new Type[] { typeof(StandardPageType) })]
    public class StartPageType : BasePageData
    {

    }

#71546
May 22, 2013 13:27
Vote:
 

Ok, thanks

#71562
May 22, 2013 14:59
Vote:
 

Take a look at http://talk.alfnilsson.se/2013/03/08/creating-page-type-classes-from-page-types-in-episerver-cms-7/ that will make creating classes for existing page types

#71946
Jun 02, 2013 16:21
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.