|Number of votes:||1|
EPiServer CMS 6 introduces Page Objects. A Page Object is simply a .NET object that is created by the developer and then associated to an EPiServer CMS page via the EPiServer.Core.PageData.PageObjects collection.
Saving Page Objects is a relatively simple task but there a couple of pitfalls so here are some best practice guidelines to follow:
Create your object as normal:
Add the object to the PageObjects collection for the current page:
And then save the current page (as the same version)
Updating an existing object requires a modified flag to be set so the DataFactory knows what to update:
IMPORTANT: Replacing an existing object will create a new row in the database if your object does not implement EPiServer.Data.Dynamic.IDynamicData as it’s identity cannot be determined.
Removing a Page Object is simple: