Class PropertyData
Abstract class that all content properties inherit from.
Inheritance
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public abstract class PropertyData : Object, IReadOnly<PropertyData>, IReadOnly
Remarks
You can make your own properties and use them just as the built-in EPiServer properties. This is done by using PropertyDefinitionTypePlugInAttribute to automatically register the property data type.
Constructors
PropertyData()
Initializes new instance
Declaration
protected PropertyData()
PropertyData(Boolean)
Initializes new instance
Declaration
protected PropertyData(bool isNull)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isNull | Defines if the property has a value or not. Used by inherited classes constructors. |
Properties
DisplayEditUI
If the property should display an edit user interface.
Declaration
public virtual bool DisplayEditUI { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
FieldOrder
Which sort order is used when loading and displaying property data objects
Declaration
public int FieldOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Used to sort properties for editing purposes.
IsDynamicProperty
Test if this property has been set by a dynamic property.
Declaration
public bool IsDynamicProperty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsLanguageSpecific
Test if this property is specific to a language in multilanguage configuration
Declaration
public virtual bool IsLanguageSpecific { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsMetaData
Test if this property represents metadata or content type information.
Declaration
public bool IsMetaData { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if this property is meta data. |
IsModified
Check if property has been modified.
Declaration
public virtual bool IsModified { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsNull
Check for null property (no value has been set).
Declaration
public virtual bool IsNull { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsPropertyData
If this property is a standard page property.
Declaration
public bool IsPropertyData { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This simply determines that it is not a dynamic property and not meta data.
IsReadOnly
Gets and sets the read-only property.
Declaration
public bool IsReadOnly { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsRequired
Check if the property value is required.
Declaration
public bool IsRequired { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Locate
Gets the object used to resolve services part of the public API.
Declaration
public ServiceProviderHelper Locate { get; }
Property Value
Type | Description |
---|---|
ServiceProviderHelper |
Name
The name of the property.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the property. |
OwnerTab
Which tab (i.e. edit mode group) the property belongs to.
Declaration
public int OwnerTab { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Used to group properties for editing purposes. See EditTab for a list of predifined tabs. If this value is set to a non-existing tab the property will not be rendered in EPiServers edit mode.
Parent
Gets or sets the parent of this instance.
Declaration
public PropertyDataCollection Parent { get; set; }
Property Value
Type | Description |
---|---|
PropertyDataCollection | The parent. |
Remarks
A PropertyData instance usually belongs to a PropertyDataCollection which itself usually belongs to a PageData. This property is a back-link to the container PageDataCollection.
Note that null is a valid value for Parent.
PropertyDefinitionID
Property definition for property, i e the content type specific identity of this property.
Declaration
public virtual int PropertyDefinitionID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The identity (System.Int32) of this property definition. |
Remarks
This property is only valid if IsMetaData is false.
PropertyValueType
Gets the System.Type of the property value.
Declaration
public abstract Type PropertyValueType { get; }
Property Value
Type | Description |
---|---|
System.Type | The System.Type of the property value. |
Type
Property type as defined by enum PropertyDataType.
Declaration
public abstract PropertyDataType Type { get; }
Property Value
Type | Description |
---|---|
PropertyDataType | The type as defined by enum PropertyDataType. |
Value
Gets or sets the value of the property.
Declaration
public abstract object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The value of the property or null if the property has no value defined. |
Methods
BuildRegularExpression(String[])
Creates a regular expression to be able to restore an array of html tags.
Declaration
protected string BuildRegularExpression(string[] safeTags)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | safeTags | The html tags that you want to appear as tags instead of encoded text. |
Returns
Type | Description |
---|---|
System.String | A regular expression to be able to restore an array of html tags. |
Clear()
Clear value and set as null/undefined.
Declaration
public virtual void Clear()
Remarks
If the property is a required property, calling the Clear method will throw a RequiredPropertyValueException exception. Check IsRequired to see if this a required property.
Copy()
Creates a copy of this object.
Declaration
public virtual PropertyData Copy()
Returns
Type | Description |
---|---|
PropertyData | A PropertyData object. |
CreateWritableClone()
Creates a writable clone of the property.
Declaration
public virtual PropertyData CreateWritableClone()
Returns
Type | Description |
---|---|
PropertyData | A writable copy of the property. |
EncodeForWebString(String)
Encodes a string to be displayed on a web page.
Declaration
protected virtual string EncodeForWebString(string stringValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | stringValue | The string value. |
Returns
Type | Description |
---|---|
System.String | A string where all html tags except those defined in 'EPiServer.Configuration.Settings.UISafeHtmlTags' have been encoded and therefore will appear in the text instead of tags. |
Remarks
The character '& will also be encoded to '&'.
GetValueOrDefault<T>()
Casts and returns the value of the property
If the property is null, then the default value for T
will be returned
Declaration
public T GetValueOrDefault<T>()
Returns
Type | Description |
---|---|
T | The value of the property or default |
Type Parameters
Name | Description |
---|---|
T | The type to cast to |
Remarks
The method performs a cast, it will not try to convert the value from one type to another. Meaning if the property value is
not assignable to T
a cast exception will be thrown
InitializeData(PropertyDataCollection)
Initialize any internal data. Called after loading the property's value but before setting it to read only.
Declaration
public virtual void InitializeData(PropertyDataCollection properties)
Parameters
Type | Name | Description |
---|---|---|
PropertyDataCollection | properties | Current property collection. |
Remarks
Put any database communication in this method.
IsEmptyValue(Object)
Called to determine if current value is considered empty.
Declaration
protected virtual bool IsEmptyValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Default implementation returns true for System.String.Empty
LoadData(Object)
Sets the internal representation from what is stored in the database. "Deserialize".
Declaration
public virtual void LoadData(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value. |
MakeReadOnly()
Convert this property to ReadOnly
Declaration
public virtual void MakeReadOnly()
Remarks
Implementors should override this method when exposing complex objects that should be read-only as well.
Modified()
Make the property appear as modified.
Declaration
protected void Modified()
ModifiedNoCheck()
Sets the property as modified without first checking if the property is set to read only.
Declaration
protected void ModifiedNoCheck()
ParseToSelf(String)
Sets the value of the property from a string representation.
Declaration
public abstract void ParseToSelf(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string value to parse. |
QualifyAsNullString(String)
Help method to test if a string should be considered as a null value.
Declaration
public static bool QualifyAsNullString(string stringToCheck)
Parameters
Type | Name | Description |
---|---|---|
System.String | stringToCheck | The string to check. |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Same as String.IsNullOrEmpty.
SaveData(PropertyDataCollection)
Return any internal data that will be stored to the database. "Serialize".
Declaration
public virtual object SaveData(PropertyDataCollection properties)
Parameters
Type | Name | Description |
---|---|---|
PropertyDataCollection | properties | Current property collection. |
Returns
Type | Description |
---|---|
System.Object | The "serializable" value of the property. |
SetDefaultValue()
Sets the default value for this property.
Declaration
protected abstract void SetDefaultValue()
SetPropertyValue(Object, SetPropertyValueDelegate)
Sets the property value.
Declaration
protected void SetPropertyValue(object value, SetPropertyValueDelegate doSet)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to set. Null will clear the value. |
SetPropertyValueDelegate | doSet | The SetPropertyValueDelegate that is responsible to set the value to the specific type. |
ThrowIfReadOnly()
Checks if the property is read-only
Declaration
protected void ThrowIfReadOnly()
ToString()
Get the property's values display string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
ToString(CultureInfo)
Get the property's values display string.
Declaration
public virtual string ToString(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture |
Returns
Type | Description |
---|---|
System.String |
ToWebString()
Get the web string representation of the property's value, on properties that do not use the editor this string will not contain any markup characters.
Declaration
public virtual string ToWebString()
Returns
Type | Description |
---|---|
System.String | A string where all html tags except those defined in 'EPiServer.Configuration.Settings.UISafeHtmlTags' have been encoded and therefore will appear in the text instead of tags. |
Remarks
The character '& will also be encoded to '&'.
Translate(String)
Translate the given key.
Declaration
public static string Translate(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The string to translate. |
Returns
Type | Description |
---|---|
System.String |
Explicit Interface Implementations
IReadOnly.CreateWritableClone()
Creates writable clone of this object.
Declaration
object IReadOnly.CreateWritableClone()
Returns
Type | Description |
---|---|
System.Object | Writable clone object. |