Class PropertyDefinition
Represents the meta data definitions of a PropertyData.
Inheritance
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public class PropertyDefinition : Object, IReadOnly<PropertyDefinition>, IReadOnly
Constructors
PropertyDefinition()
Initializes a new instance of the PropertyDefinition class.
Declaration
public PropertyDefinition()
Properties
ContentTypeID
Gets or sets the ID of the ContentType that this property definition is a part of.
Declaration
public int ContentTypeID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This value should be 0 for dynamic property definitions.
DefaultValue
The default value
Declaration
public string DefaultValue { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DefaultValueType
Default value handling
Declaration
public DefaultValueType DefaultValueType { get; set; }
Property Value
Type | Description |
---|---|
DefaultValueType |
DisplayEditUI
If properties of this definition should display an edit user interface.
Declaration
public bool DisplayEditUI { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EditCaption
Gets or sets the display name that should be used when editing a property of this PropertyDefinition.
Declaration
public string EditCaption { get; set; }
Property Value
Type | Description |
---|---|
System.String |
EditorHint
allow clients to get or set editor hint used to render property by code instead of UIHintAttribute
Declaration
public string EditorHint { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ExistsOnModel
Gets or sets a value indicating whether this instance exists on a model class.
Declaration
public bool ExistsOnModel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
FieldOrder
Gets or sets the field order used for ordering the properties in edit mode (read-only).
Declaration
public int FieldOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This field is read-only, use the MoveUp/MoveDown methods to resort
HelpText
Gets or sets the text that should be used as help when editing a property of this PropertyDefinition.
Declaration
public string HelpText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ID
Gets or sets the unique identifier for this property definition.
Declaration
public int ID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Set value to 0 to create new definition
IsDynamicProperty
Gets a value indicating if this definition is a dynamic property definition.
Declaration
public bool IsDynamicProperty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsReadOnly
Gets a value indicating if current instance is read-only.
Declaration
public virtual bool IsReadOnly { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LanguageSpecific
If properties of this definition should be specific for each language
Declaration
public bool LanguageSpecific { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LocalizationService
Gets or sets the LocalizationService used by the current PropertyData instance to retrieve localized texts.
Declaration
public virtual LocalizationService LocalizationService { get; set; }
Property Value
Type | Description |
---|---|
LocalizationService | The current LocalizationService used internally. |
Name
Gets or sets the short name of the property definition used in code.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Required
Gets or sets a value indicating if a property of this PropertyDefinition is required to have a value.
Declaration
public bool Required { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Searchable
Gets or sets a value indicating whether a property of this PropertyDefinition should be searchable.
Declaration
public bool Searchable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SettingsID
Gets or sets the ID of the settings container object.
Declaration
public Guid SettingsID { get; set; }
Property Value
Type | Description |
---|---|
System.Guid | The settings container ID. |
Tab
Gets or sets the TabDefinition group where this PropertyDefinition belongs to.
Declaration
public TabDefinition Tab { get; set; }
Property Value
Type | Description |
---|---|
TabDefinition |
TemplateHint
Gets or sets the template hint that will be used when resolving render.
Declaration
public string TemplateHint { get; set; }
Property Value
Type | Description |
---|---|
System.String | The template hint. |
Type
Gets or sets the PropertyDefinitionType that handles this property definition.
Declaration
public PropertyDefinitionType Type { get; set; }
Property Value
Type | Description |
---|---|
PropertyDefinitionType |
Methods
CreateWritableClone()
Creates a writable clone of this object.
Declaration
public PropertyDefinition CreateWritableClone()
Returns
Type | Description |
---|---|
PropertyDefinition | A clone of this object that is writable. |
MakeReadOnly()
Makes the current instance and all it's properties read-only.
Declaration
public virtual void MakeReadOnly()
Remarks
After calling this method the IsReadOnly property will return true
.
ResetPropertyDefinition()
Resets data that can be set from model.
Declaration
public virtual void ResetPropertyDefinition()
ThrowIfReadOnly()
Throws an exception if the current instance is read-only.
Declaration
protected virtual void ThrowIfReadOnly()
TranslateDescription()
Translates the description to the current language.
Declaration
public virtual string TranslateDescription()
Returns
Type | Description |
---|---|
System.String | The translated description |
Remarks
If no translation is found the HelpText defined in the PropertyDefinition will be used.
TranslateDescription(String, String)
Translates the description to the current language.
Declaration
public static string TranslateDescription(string propertyName, string pageTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property. |
System.String | pageTypeName | Name of the page type. |
Returns
Type | Description |
---|---|
System.String | The translated description; or null if no translation was found. |
TranslateDescription(String, String, LocalizationService)
Translates the description to the current language.
Declaration
public static string TranslateDescription(string propertyName, string pageTypeName, LocalizationService localizationService)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property. |
System.String | pageTypeName | Name of the page type. |
LocalizationService | localizationService | The localization service to use for the translation. |
Returns
Type | Description |
---|---|
System.String | The translated description; or null if no translation was found. |
TranslateDisplayName()
Translates the display name to the current language.
Declaration
public virtual string TranslateDisplayName()
Returns
Type | Description |
---|---|
System.String | The translated display name. |
Remarks
If no translation is found the edit caption defined in the PropertyDefinition will be used.
TranslateDisplayName(String, String)
Translates the display name to the current language.
Declaration
public static string TranslateDisplayName(string propertyName, string pageTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property. |
System.String | pageTypeName | Name of the page type. |
Returns
Type | Description |
---|---|
System.String | The translated display name; or null if no translation was found. |
TranslateDisplayName(String, String, LocalizationService)
Translates the display name to the current language.
Declaration
public static string TranslateDisplayName(string propertyName, string pageTypeName, LocalizationService localizationService)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property. |
System.String | pageTypeName | Name of the page type. |
LocalizationService | localizationService | The localization service to use for the translation. |
Returns
Type | Description |
---|---|
System.String | The translated display name; or null if no translation was found. |
Explicit Interface Implementations
IReadOnly.CreateWritableClone()
Creates a writable clone of this object.
Declaration
object IReadOnly.CreateWritableClone()
Returns
Type | Description |
---|---|
System.Object | A clone of this object that is writable. |