Try our conversational search powered by Generative AI!

Creating page types in code for existing pages


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?

May 22, 2013 13:13

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


May 22, 2013 13:27

Ok, thanks

May 22, 2013 14:59

Take a look at that will make creating classes for existing page types

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.