Slight update on the Tool for Page Type Classes from Page Types in EPiServer 7 CMS

I made a small mistake on the Page Type Class Tool for EPiServer 7 CMS. This was on the SetDefaultValues method where the ChildOrderRule was set to FilterSortOrder.None.

If a Page have a ChildOrderRule set to None, EPiServer won’t be able to find the Children of that Page since the Stored Procedure does not know how to handle that ChildOrderRule.

Therefore I have added a check whether pageType.Defaults.ChildOrderRule is not FilterSortOrder.None before setting the value.

Some information behind the scenes

FilterSortOrder.None is basically a value that means that there is no specific default value setting for this Page Type stored in tblPropertyDefinitionDefault.

If the ChildOrderRule is set to None, the default values provided by PageDataBuilder.SetPropertyValues() will be set, which means that the default value is 1 (CreatedDescending).

Even the class PageData where SetDefaultValues() is defined have a check for ChildOrderRule.

if (pageType.Defaults.ChildOrderRule != FilterSortOrder.None)
    property["PageChildOrderRule"].Value = (object) pageType.Defaults.ChildOrderRule;

What should I do if I have used the faulty version?

All you need to do is to remove the following row from all your Page Type Classes:

this[MetaDataProperties.PageChildOrderRule] = FilterSortOrder.None;

And run following in your database to fix all pages that have already been created with wrong ChildOrderRule:

UPDATE [tblContent] SET ChildOrderRule = 1 WHERE ChildOrderRule = -1

I am sorry for the inconvenience, if you find more bugs or have suggestions on how to improve, please tell me.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: