Class PropertyType
Represents a property type.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
[DataContract(IsReference = true)]
public class PropertyType : EntityBase, IPropertyType, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty
Constructors
View SourcePropertyType(IShortStringHelper, String, ValueStorageType)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IShortStringHelper shortStringHelper, string propertyEditorAlias, ValueStorageType valueStorageType)
Parameters
Type | Name | Description |
---|---|---|
IShortStringHelper | shortStringHelper | |
System.String | propertyEditorAlias | |
ValueStorageType | valueStorageType |
PropertyType(IShortStringHelper, String, ValueStorageType, Boolean, String)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IShortStringHelper shortStringHelper, string propertyEditorAlias, ValueStorageType valueStorageType, bool forceValueStorageType, string propertyTypeAlias = null)
Parameters
Type | Name | Description |
---|---|---|
IShortStringHelper | shortStringHelper | |
System.String | propertyEditorAlias | |
ValueStorageType | valueStorageType | |
System.Boolean | forceValueStorageType | |
System.String | propertyTypeAlias |
Remarks
Set forceValueStorageType
to true to force the value storage type. Values assigned to
the property, eg from the underlying datatype, will be ignored.
PropertyType(IShortStringHelper, String, ValueStorageType, String)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IShortStringHelper shortStringHelper, string propertyEditorAlias, ValueStorageType valueStorageType, string propertyTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IShortStringHelper | shortStringHelper | |
System.String | propertyEditorAlias | |
ValueStorageType | valueStorageType | |
System.String | propertyTypeAlias |
PropertyType(IShortStringHelper, IDataType)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IShortStringHelper shortStringHelper, IDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
IShortStringHelper | shortStringHelper | |
IDataType | dataType |
PropertyType(IShortStringHelper, IDataType, String)
Initializes a new instance of the PropertyType class.
Declaration
public PropertyType(IShortStringHelper shortStringHelper, IDataType dataType, string propertyTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IShortStringHelper | shortStringHelper | |
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 |
---|---|
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 of 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.Nullable<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; set; }
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 |
ValueStorageType
Gets or sets the database type for storing value for this property type.
Declaration
[DataMember]
public ValueStorageType ValueStorageType { get; set; }
Property Value
Type | Description |
---|---|
ValueStorageType |
Variations
Gets or sets the content variation of the property type.
Declaration
public ContentVariation Variations { get; set; }
Property Value
Type | Description |
---|---|
ContentVariation |
Methods
View SourceEquals(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 |
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 |