Search Results for

    Show / Hide Table of Contents
    View Source

    Class PublishedPropertyBase

    Provides a base class for IPublishedProperty implementations which converts and caches the value source to the actual value to use when rendering content.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Models.PublishedContent
    Assembly: Umbraco.Core.dll
    Syntax
    public abstract class PublishedPropertyBase : IPublishedProperty

    Constructors

    View Source

    PublishedPropertyBase(IPublishedPropertyType, PropertyCacheLevel)

    Initializes a new instance of the PublishedPropertyBase class.

    Declaration
    protected PublishedPropertyBase(IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType
    PropertyCacheLevel referenceCacheLevel

    Properties

    View Source

    Alias

    Gets the alias of the property.

    Declaration
    public string Alias { get; }
    Property Value
    Type Description
    System.String
    View Source

    PropertyType

    Gets the property type.

    Declaration
    public IPublishedPropertyType PropertyType { get; }
    Property Value
    Type Description
    IPublishedPropertyType
    View Source

    ReferenceCacheLevel

    Gets the property reference cache level.

    Declaration
    public PropertyCacheLevel ReferenceCacheLevel { get; }
    Property Value
    Type Description
    PropertyCacheLevel

    Methods

    View Source

    GetDeliveryApiValue(Boolean, String, String)

    Gets the object value of the property for Delivery API representation.

    Declaration
    public abstract object GetDeliveryApiValue(bool expanding, string culture = null, string segment = null)
    Parameters
    Type Name Description
    System.Boolean expanding
    System.String culture
    System.String segment
    Returns
    Type Description
    System.Object
    Remarks

    The value is what you want to use when rendering content through the Delivery API.

    It can be null, or any type of CLR object.

    It has been fully prepared and processed by the appropriate converter.

    View Source

    GetSourceValue(String, String)

    Gets the source value of the property.

    Declaration
    public abstract object GetSourceValue(string culture = null, string segment = null)
    Parameters
    Type Name Description
    System.String culture
    System.String segment
    Returns
    Type Description
    System.Object
    Remarks

    The source value is whatever was passed to the property when it was instantiated, and it is somewhat implementation-dependent -- depending on how the IPublishedCache is implemented.

    The XmlPublishedCache source values are strings exclusively since they come from the Xml cache.

    For other caches that get their source value from the database, it would be either a string, an integer (Int32), a date and time (DateTime) or a decimal (double).

    If you're using that value, you're probably wrong, unless you're doing some internal Umbraco stuff.

    View Source

    GetValue(String, String)

    Gets the object value of the property.

    Declaration
    public abstract object GetValue(string culture = null, string segment = null)
    Parameters
    Type Name Description
    System.String culture
    System.String segment
    Returns
    Type Description
    System.Object
    Remarks

    The value is what you want to use when rendering content in an MVC view ie in C#.

    It can be null, or any type of CLR object.

    It has been fully prepared and processed by the appropriate converter.

    View Source

    HasValue(String, String)

    Gets a value indicating whether the property has a value.

    Declaration
    public abstract bool HasValue(string culture = null, string segment = null)
    Parameters
    Type Name Description
    System.String culture
    System.String segment
    Returns
    Type Description
    System.Boolean
    Remarks

    This is somewhat implementation-dependent -- depending on whatever IPublishedCache considers a missing value.

    The XmlPublishedCache raw values are strings, and it will consider missing, null or empty (and that includes whitespace-only) strings as "no value".

    Other caches that get their raw value from the database would consider that a property has "no value" if it is missing, null, or an empty string (including whitespace-only).

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • PublishedPropertyBase(IPublishedPropertyType, PropertyCacheLevel)
    • Properties
      • Alias
      • PropertyType
      • ReferenceCacheLevel
    • Methods
      • GetDeliveryApiValue(Boolean, String, String)
      • GetSourceValue(String, String)
      • GetValue(String, String)
      • HasValue(String, String)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX