Class PropertyType
Represents a property type.
Namespace: Umbraco.Core.Models
Assembly: Umbraco.Core.dll
Syntax
[Serializable]
[DataContract(IsReference = true)]
public class PropertyType : EntityBase, IRememberBeingDirty, ICanBeDirty, IEntity, IDeepCloneable, IEquatable<PropertyType>
Constructors
View SourcePropertyType(String, ValueStorageType)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(string propertyEditorAlias, ValueStorageType valueStorageType)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyEditorAlias | |
ValueStorageType | valueStorageType |
PropertyType(String, ValueStorageType, String)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(string propertyEditorAlias, ValueStorageType valueStorageType, string propertyTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyEditorAlias | |
ValueStorageType | valueStorageType | |
System.String | propertyTypeAlias |
PropertyType(IDataType)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType |
PropertyType(IDataType, String)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IDataType dataType, string propertyTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType | |
System.String | propertyTypeAlias |
Properties
View SourceAlias
Gets of sets the alias of the property type.
Declaration
[DataMember]
public virtual string Alias { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DataTypeId
Gets or sets the identifier of the datatype for this property type.
Declaration
[DataMember]
public int DataTypeId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DataTypeKey
Declaration
[DataMember]
public Guid DataTypeKey { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
Description
Gets of sets the description of the property type.
Declaration
[DataMember]
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
LabelOnTop
Gets or sets a value indicating whether the label of this property type should be displayed on top.
Declaration
[DataMember]
public bool LabelOnTop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Mandatory
Gets or sets a value indicating whether a value for this property type is required.
Declaration
[DataMember]
public bool Mandatory { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
MandatoryMessage
Gets or sets the custom validation message used when a value for this PropertyType is required
Declaration
[DataMember]
public string MandatoryMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Name
Gets of sets the name of the property type.
Declaration
[DataMember]
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PropertyEditorAlias
Gets or sets the alias of the property editor for this property type.
Declaration
[DataMember]
public string PropertyEditorAlias { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PropertyGroupId
Gets or sets the identifier of the property group this property type belongs to.
Declaration
[DataMember]
public Lazy<int> PropertyGroupId { get; set; }
Property Value
Type | Description |
---|---|
System.Lazy<System.Int32> |
Remarks
For generic properties, the value is null
.
SortOrder
Gets of sets the sort order of the property type.
Declaration
[DataMember]
public int SortOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SupportsPublishing
Gets a value indicating whether the content type owning this property type is publishing.
Declaration
public bool SupportsPublishing { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
A publishing content type supports draft and published values for properties. It is possible to retrieve either the draft (default) or published value of a property. Setting the value always sets the draft value, which then needs to be published.
A non-publishing content type only supports one value for properties. Getting the draft or published value of a property returns the same thing, and publishing a value property has no effect.
When true, getting the property value returns the edited value by default, but it is possible to get the published value using the appropriate 'published' method parameter.
When false, getting the property value always return the edited value, regardless of the 'published' method parameter.
ValidationRegExp
Gets or sets the regular expression validating the property values.
Declaration
[DataMember]
public string ValidationRegExp { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ValidationRegExpMessage
Gets or sets the custom validation message used when a pattern for this PropertyType must be matched
Declaration
[DataMember]
public string ValidationRegExpMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Variations
Gets or sets the content variation of the property type.
Declaration
public ContentVariation Variations { get; set; }
Property Value
Type | Description |
---|---|
ContentVariation |
Methods
View SourceConvertAssignedValue(Object)
Converts a value assigned to a property.
Declaration
public object ConvertAssignedValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.Object |
Remarks
The input value can be pretty much anything, and is converted to the actual CLR type expected by the property (eg an integer if the property values are integers).
Throws if the value cannot be converted.
CreateProperty()
Creates a new property of this property type.
Declaration
public Property CreateProperty()
Returns
Type | Description |
---|---|
Property |
Equals(PropertyType)
Declaration
public bool Equals(PropertyType other)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | other |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
IsOfExpectedPropertyType(Object)
Determines whether a value is of the expected type for this property type.
Declaration
public bool IsOfExpectedPropertyType(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
If the value is of the expected type, it can be directly assigned to the property. Otherwise, some conversion is required.
IsValueAssignable(Object)
Determines whether a value can be assigned to a property.
Declaration
public bool IsValueAssignable(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.Boolean |
PerformDeepClone(Object)
Used by inheritors to modify the DeepCloning logic
Declaration
protected override void PerformDeepClone(object clone)
Parameters
Type | Name | Description |
---|---|---|
System.Object | clone |
SupportsVariation(String, String, Boolean)
Determines whether the property type supports a combination of culture and segment.
Declaration
public bool SupportsVariation(string culture, string segment, bool wildcards = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | The culture. |
System.String | segment | The segment. |
System.Boolean | wildcards | A value indicating whether wildcards are valid. |
Returns
Type | Description |
---|---|
System.Boolean |
TryConvertAssignedValue(Object, out Object)
Tries to convert a value assigned to a property.
Declaration
public bool TryConvertAssignedValue(object value, out object converted)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | |
System.Object | converted |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks