Class PageObjectManager
Class for working with Page Object associated with an EPiServer CMS Page
Inheritance
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 8.11.0Syntax
[Obsolete("Page Objects are being phased out in favor of blocks, you can still use the Page Objects API in this version but it will be removed in future versions")]
public class PageObjectManager
Constructors
PageObjectManager(PageData)
Construct an instance with the pageData passed
Declaration
public PageObjectManager(PageData pageData)
Parameters
| Type | Name | Description |
|---|---|---|
| PageData | pageData | A PageData object whose Page Objects will be managed by this instance |
PageObjectManager(PageData, IPageObjectRepository)
Construct an instance with the pageData and repository passed
Declaration
public PageObjectManager(PageData pageData, IPageObjectRepository repository)
Parameters
| Type | Name | Description |
|---|---|---|
| PageData | pageData | A PageData object whose Page Objects will be managed by this instance |
| IPageObjectRepository | repository | The IPageObjectRepository to use |
PageObjectManager(Guid)
Construct an instance with the pageGuid passed
Declaration
protected PageObjectManager(Guid pageGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | pageGuid | The id of the page whose Page Objects will be managed by this instance |
PageObjectManager(Guid, String)
Construct an instance with the pageGuid and pageLanguageBranch passed
Declaration
protected PageObjectManager(Guid pageGuid, string pageLanguageBranch)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | pageGuid | The id of the page whose Page Objects will be managed by this instance |
| System.String | pageLanguageBranch | The language branch of the page whose Page Objects will be managed by this instance |
PageObjectManager(Guid, String, Int32)
Construct an instance with the pageGuid, pageLanguageBranch and workPageId passed
Declaration
public PageObjectManager(Guid pageGuid, string pageLanguageBranch, int workPageId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | pageGuid | The id of the page whose Page Objects will be managed by this instance |
| System.String | pageLanguageBranch | The language branch of the page whose Page Objects will be managed by this instance |
| System.Int32 | workPageId | The work id of the page whose Page Objects will be managed by this instance |
PageObjectManager(Guid, String, Int32, IPageObjectRepository)
Construct an instance with the pageGuid, pageLanguageBranch, workPageId and repository passed
Declaration
public PageObjectManager(Guid pageGuid, string pageLanguageBranch, int workPageId, IPageObjectRepository repository)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | pageGuid | The id of the page whose Page Objects will be managed by this instance |
| System.String | pageLanguageBranch | The language branch of the page whose Page Objects will be managed by this instance |
| System.Int32 | workPageId | The work id of the page whose Page Objects will be managed by this instance |
| IPageObjectRepository | repository | The IPageObjectRepository to use |
Properties
Repository
The repository used by this instance
Declaration
public virtual IPageObjectRepository Repository { get; set; }
Property Value
| Type | Description |
|---|---|
| IPageObjectRepository |
Methods
Delete(String[])
Deletes the page objects with the names passed
Declaration
public virtual void Delete(params string[] pageObjectsNames)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | pageObjectsNames | An array of System.String identifing the page objects to delete |
DeleteAll()
Delete all page objects for the page associated with the instance
Declaration
public virtual void DeleteAll()
DeleteLanguageBranchOwned()
Delete all page objects that are PageLanguageBranch owned for the page and language branch associated with the instance
Declaration
protected virtual void DeleteLanguageBranchOwned()
DeletePageVersionOwned()
Delete all page objects that are PageVersion owned for the page and work id associated with the instance
Declaration
protected virtual void DeletePageVersionOwned()
InternalSave(PageObject[])
Save the pageObjects passed
Declaration
protected virtual void InternalSave(params PageObject[] pageObjects)
Parameters
| Type | Name | Description |
|---|---|---|
| PageObject[] | pageObjects | An array of page objects to save |
InternalSave(String, Object, Nullable<PageObject.OwnerOption>)
Saves the value passed and associates it with the page associated with this instance
Declaration
protected virtual void InternalSave(string name, object value, PageObject.OwnerOption? ownerOption)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to associate with the value |
| System.Object | value | The object to save |
| System.Nullable<PageObject.OwnerOption> | ownerOption | The optional PageObject.OwnerOption for the object |
Remarks
If ownerOption has value then it will be used. If it does not have value
then the behaviour depends on the existence of the page object or not.
For existing page objects no changes will be made to its OwnerOption value. For new page objects
the default value of PageLanguageBranch will be used.
Note that changing the OwnerOption for an existing page object will cause the existing
object to be overwritten by the one being saved now.
Load(String)
Load an object by name for the page associated with this instance
Declaration
public virtual object Load(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the object to load |
Returns
| Type | Description |
|---|---|
| System.Object | A object instance or null if not found |
Load<TObject>(String)
Load an object by name for the page associated with this instance
Declaration
public virtual TObject Load<TObject>(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the object to load |
Returns
| Type | Description |
|---|---|
| TObject | A object instance or null if not found |
Type Parameters
| Name | Description |
|---|---|
| TObject | The System.Type to cast the objec to |
Remarks
If the object is not of type TObject then an System.InvalidCastException exception will be thrown
LoadAll()
Loads all page objects for the page associated with this instance
Declaration
public virtual IDictionary<string, object> LoadAll()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.String, System.Object> | An System.Collections.Generic.IDictionary<TKey, TValue> instance containing name-objects pairs |
LoadAllMetaObjects()
Loads all meta objects for the page associated with this instance
Declaration
public virtual IEnumerable<PageObject> LoadAllMetaObjects()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<PageObject> | An enumerable of PageObject instances |
LoadMetaObject(String)
Loads the meta object by name for the page associated with this instance
Declaration
public virtual PageObject LoadMetaObject(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the object to load |
Returns
| Type | Description |
|---|---|
| PageObject | A PageObject instance or null if not found |
Save(String, Object)
Saves the value passed and associates it with the page associated with this instance
Declaration
public virtual void Save(string name, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to associate with the value |
| System.Object | value | The object to save |
Remarks
The PageObject.OwnerOption for the object will be set to PageLanguageBranch for new objects or will remain untouched for existing objects.
Save(String, Object, PageObject.OwnerOption)
Saves the value passed and associates it with the page associated with this instance
Declaration
public virtual void Save(string name, object value, PageObject.OwnerOption ownerOption)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to associate with the value |
| System.Object | value | The object to save |
| PageObject.OwnerOption | ownerOption | The PageObject.OwnerOption for the object |
Remarks
Note that changing the OwnerOption for an existing page object will cause the existing object to be overwritten by the one being saved now.
ValidateLanguageBranchSet()
Validate that the page language branch has been set via the constructor
Declaration
protected virtual void ValidateLanguageBranchSet()
ValidateWorkPageIdSet()
Validate that the work page id has been set via the constructor
Declaration
protected virtual void ValidateWorkPageIdSet()