Save page to storage with specified action. If save is to be supported this method needs to be overriden

Namespace:  EPiServer.Core
Assembly:  EPiServer (in EPiServer.dll) Version: 5.2.375.236

Syntax

C#
public virtual PageReference Save(
	PageData page,
	SaveAction action
)

Parameters

page
Type: EPiServer.Core..::.PageData
A initalized PageData object containing data to be saved
action
Type: EPiServer.DataAccess..::.SaveAction
Action that will be performed

Return Value

Implements

IPageStore..::.Save(PageData, SaveAction)

Remarks

If PageLink is empty a new page will be created

Examples

The following code sample is an implementation of Save() for XmlPageProvider.
CopyC#
public override PageReference Save(PageData page, EPiServer.DataAccess.SaveAction action)
{

    //Set status of page
    SetPageStatus(page, action);

    //select all versions of this page
    var pages = from singlePage in XmlPages.Elements("pages").Elements<XElement>("page")
                where int.Parse(singlePage.Attribute("id").Value) == page.PageLink.ID
                select singlePage;
    int versionId = GetVersionId(page, pages, ref action);

    if (action == SaveAction.Save)
    {
        Save(page, versionId);
    }
    else if (action == SaveAction.Publish)
    {
        Publish(page, versionId, pages);
    }

    XmlPages.Save(_filePath);

    return page.PageLink;
}

Exceptions

ExceptionCondition
System..::.NotImplementedException Thrown if the Page Provider indicates support for Save with the Capabilities property, but does not override Move method.
System..::.NotSupportedException Thrown if the Page Provider does not support Save functionality.

See Also