Class PublishedPropertyType
Represents a published property type.
Inheritance
Namespace: Umbraco.Cms.Core.Models.PublishedContent
Assembly: Umbraco.Core.dll
Syntax
public class PublishedPropertyType : IPublishedPropertyType
Remarks
Instances of the PublishedPropertyType class are immutable, ie if the property type changes, then a new class needs to be created.
Constructors
View SourcePublishedPropertyType(String, Int32, Boolean, ContentVariation, PropertyValueConverterCollection, IPublishedModelFactory, IPublishedContentTypeFactory)
This constructor is for tests and is not intended to be used directly from application code.
Declaration
public PublishedPropertyType(string propertyTypeAlias, int dataTypeId, bool isUserProperty, ContentVariation variations, PropertyValueConverterCollection propertyValueConverters, IPublishedModelFactory publishedModelFactory, IPublishedContentTypeFactory factory)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | |
System.Int32 | dataTypeId | |
System.Boolean | isUserProperty | |
ContentVariation | variations | |
PropertyValueConverterCollection | propertyValueConverters | |
IPublishedModelFactory | publishedModelFactory | |
IPublishedContentTypeFactory | factory |
Remarks
Values are assumed to be consistent and are not checked.
The new published property type does not belong to a published content type.
PublishedPropertyType(IPublishedContentType, String, Int32, Boolean, ContentVariation, PropertyValueConverterCollection, IPublishedModelFactory, IPublishedContentTypeFactory)
This constructor is for tests and is not intended to be used directly from application code.
Declaration
public PublishedPropertyType(IPublishedContentType contentType, string propertyTypeAlias, int dataTypeId, bool isUserProperty, ContentVariation variations, PropertyValueConverterCollection propertyValueConverters, IPublishedModelFactory publishedModelFactory, IPublishedContentTypeFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContentType | contentType | |
System.String | propertyTypeAlias | |
System.Int32 | dataTypeId | |
System.Boolean | isUserProperty | |
ContentVariation | variations | |
PropertyValueConverterCollection | propertyValueConverters | |
IPublishedModelFactory | publishedModelFactory | |
IPublishedContentTypeFactory | factory |
Remarks
Values are assumed to be consisted and are not checked.
The new published property type belongs to the published content type.
PublishedPropertyType(IPublishedContentType, IPropertyType, PropertyValueConverterCollection, IPublishedModelFactory, IPublishedContentTypeFactory)
Initialize a new instance of the PublishedPropertyType class with a property type.
Declaration
public PublishedPropertyType(IPublishedContentType contentType, IPropertyType propertyType, PropertyValueConverterCollection propertyValueConverters, IPublishedModelFactory publishedModelFactory, IPublishedContentTypeFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContentType | contentType | |
IPropertyType | propertyType | |
PropertyValueConverterCollection | propertyValueConverters | |
IPublishedModelFactory | publishedModelFactory | |
IPublishedContentTypeFactory | factory |
Remarks
The new published property type belongs to the published content type.
Properties
View SourceAlias
Gets property type alias.
Declaration
public string Alias { get; }
Property Value
Type | Description |
---|---|
System.String |
CacheLevel
Gets the property cache level.
Declaration
public PropertyCacheLevel CacheLevel { get; }
Property Value
Type | Description |
---|---|
PropertyCacheLevel |
ClrType
Gets the property CLR type.
Declaration
public Type? ClrType { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Type> |
Remarks
Returns the actual CLR type which does not contain ModelType types.
Mapping from ModelClrType may throw if some ModelType instances could not be mapped to actual CLR types.
ContentType
Gets the published content type containing the property type.
Declaration
public IPublishedContentType ContentType { get; }
Property Value
Type | Description |
---|---|
IPublishedContentType |
DataType
Gets the data type.
Declaration
public PublishedDataType DataType { get; }
Property Value
Type | Description |
---|---|
PublishedDataType |
EditorAlias
Gets the property editor alias.
Declaration
public string EditorAlias { get; }
Property Value
Type | Description |
---|---|
System.String |
IsUserProperty
Gets a value indicating whether the property is a user content property.
Declaration
public bool IsUserProperty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
A non-user content property is a property that has been added to a published content type by Umbraco but does not corresponds to a user-defined published property.
ModelClrType
Gets the property model CLR type.
Declaration
public Type ModelClrType { get; }
Property Value
Type | Description |
---|---|
Type |
Remarks
The model CLR type may be a ModelType type, or may contain ModelType types.
For the actual CLR type, see ClrType.
Variations
Gets the content variations of the property type.
Declaration
public ContentVariation Variations { get; }
Property Value
Type | Description |
---|---|
ContentVariation |
Methods
View SourceConvertInterToObject(IPublishedElement, PropertyCacheLevel, Object, Boolean)
Converts the intermediate value into the object value.
Declaration
public object ConvertInterToObject(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
Parameters
Type | Name | Description |
---|---|---|
IPublishedElement | owner | The published element owning the property. |
PropertyCacheLevel | referenceCacheLevel | The reference cache level. |
System.Object | inter | The intermediate value. |
System.Boolean | preview | A value indicating whether content should be considered draft. |
Returns
Type | Description |
---|---|
System.Object | The object value. |
ConvertInterToXPath(IPublishedElement, PropertyCacheLevel, Object, Boolean)
Converts the intermediate value into the XPath value.
Declaration
public object ConvertInterToXPath(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
Parameters
Type | Name | Description |
---|---|---|
IPublishedElement | owner | The published element owning the property. |
PropertyCacheLevel | referenceCacheLevel | The reference cache level. |
System.Object | inter | The intermediate value. |
System.Boolean | preview | A value indicating whether content should be considered draft. |
Returns
Type | Description |
---|---|
System.Object | The XPath value. |
Remarks
The XPath value can be either a string or an XPathNavigator.
ConvertSourceToInter(IPublishedElement, Object, Boolean)
Converts the source value into the intermediate value.
Declaration
public object ConvertSourceToInter(IPublishedElement owner, object source, bool preview)
Parameters
Type | Name | Description |
---|---|---|
IPublishedElement | owner | The published element owning the property. |
System.Object | source | The source value. |
System.Boolean | preview | A value indicating whether content should be considered draft. |
Returns
Type | Description |
---|---|
System.Object | The intermediate value. |
IsValue(Object, PropertyValueLevel)
Determines whether a value is an actual value, or not a value.
Declaration
public bool? IsValue(object value, PropertyValueLevel level)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | |
PropertyValueLevel | level |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> |
Remarks
Used by property.HasValue and, for instance, in fallback scenarios.