Read and edit dynamic properties.
Namespace:
EPiServer.DataAbstractionAssembly: EPiServer (in EPiServer.dll) Version: 5.2.375.236
Syntax
| C# |
|---|
[SerializableAttribute] public class DynamicProperty |
Remarks
EPiServer.DataAbstraction.DynamicProperty is a non-cached API for administrative purposes
and should not be used on normal templates that are not for administrative purposes. Using
this API on your templates will significally impact performance. The recommendation is always
to read dynamic properties on PageData objects returned from the global instance of the DataFactory
class, EPiServer.DataFactory.Instance.
Examples
Example that changes the value of dynamic property "MetaKeywords" on the current page.
CopyC#
Examples that outputs some debug information for the current page
CopyC#
DynamicProperty prop = DynamicProperty.Load(CurrentPage.PageLink, "MetaKeywords"); prop.PropertyValue.Value = "Keyword1,Keyword2"; prop.Save();
DynamicPropertyCollection props = DynamicProperty.ListForPage(CurrentPage.PageLink); foreach (DynamicProperty prop in props) { Response.Write("Property " + prop.PropertyValue.Name + " is"); switch (prop.Status) { case DynamicPropertyStatus.Defined: Response.Write(" set on this page to " + prop.PropertyValue.ToString()); break; case DynamicPropertyStatus.Inherited: Response.Write(" inherited from " + prop.InheritedPageLink.ToString() + " with value " + prop.InheritedValue.ToString()); break; case DynamicPropertyStatus.Undefined: Response.Write(" not defined."); break; default: break; } }