Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IContentBase

    Provides a base class for content items.

    Namespace: Umbraco.Cms.Core.Models
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IContentBase : IUmbracoEntity, ITreeEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty
    Remarks

    Content items are documents, medias and members.

    Content items have a content type, and properties.

    Properties

    View Source

    AvailableCultures

    Gets the available cultures.

    Declaration
    IEnumerable<string> AvailableCultures { get; }
    Property Value
    Type Description
    IEnumerable<string>
    Remarks

    Cannot contain the invariant culture, which is always available.

    View Source

    ContentType

    Gets the content type of this content.

    Declaration
    ISimpleContentType ContentType { get; }
    Property Value
    Type Description
    ISimpleContentType
    View Source

    ContentTypeId

    Integer Id of the default ContentType

    Declaration
    int ContentTypeId { get; }
    Property Value
    Type Description
    int
    View Source

    CultureInfos

    Gets culture infos of the content item.

    Declaration
    ContentCultureInfosCollection? CultureInfos { get; set; }
    Property Value
    Type Description
    ContentCultureInfosCollection
    Remarks

    Because a dictionary key cannot be null this cannot contain the invariant culture name, which must be get or set via the Name property.

    View Source

    Properties

    List of properties, which make up all the data available for this Content object

    Declaration
    IPropertyCollection Properties { get; set; }
    Property Value
    Type Description
    IPropertyCollection
    Remarks

    Properties are loaded as part of the Content object graph

    View Source

    VersionId

    Gets the version identifier.

    Declaration
    int VersionId { get; set; }
    Property Value
    Type Description
    int
    View Source

    WriterId

    Gets the identifier of the writer.

    Declaration
    int WriterId { get; set; }
    Property Value
    Type Description
    int

    Methods

    View Source

    GetCultureName(string?)

    Gets the name of the content item for a specified language.

    Declaration
    string? GetCultureName(string? culture)
    Parameters
    Type Name Description
    string culture
    Returns
    Type Description
    string
    Remarks

    When culture is null, gets the invariant culture name, which is the value of the Name property.

    When culture is not null, and the content type does not vary by culture, returns null.

    View Source

    GetUpdateDate(string)

    Gets the date a culture was updated.

    Declaration
    DateTime? GetUpdateDate(string culture)
    Parameters
    Type Name Description
    string culture
    Returns
    Type Description
    DateTime?
    Remarks

    When culture is null, returns null.

    If the specified culture is not available, returns null.

    View Source

    GetValue(string, string?, string?, bool)

    Gets the value of a Property

    Declaration
    object? GetValue(string propertyTypeAlias, string? culture = null, string? segment = null, bool published = false)
    Parameters
    Type Name Description
    string propertyTypeAlias
    string culture
    string segment
    bool published
    Returns
    Type Description
    object
    Remarks

    Values 'null' and 'empty' are equivalent for culture and segment.

    View Source

    GetValue<TValue>(string, string?, string?, bool)

    Gets the typed value of a Property

    Declaration
    TValue? GetValue<TValue>(string propertyTypeAlias, string? culture = null, string? segment = null, bool published = false)
    Parameters
    Type Name Description
    string propertyTypeAlias
    string culture
    string segment
    bool published
    Returns
    Type Description
    TValue
    Type Parameters
    Name Description
    TValue
    Remarks

    Values 'null' and 'empty' are equivalent for culture and segment.

    View Source

    HasProperty(string)

    Gets a value indicating whether the content entity has a property with the supplied alias.

    Declaration
    bool HasProperty(string propertyTypeAlias)
    Parameters
    Type Name Description
    string propertyTypeAlias
    Returns
    Type Description
    bool
    Remarks

    Indicates that the content entity has a property with the supplied alias, but not necessarily that the content has a value for that property. Could be missing.

    View Source

    IsCultureAvailable(string)

    Gets a value indicating whether a given culture is available.

    Declaration
    bool IsCultureAvailable(string culture)
    Parameters
    Type Name Description
    string culture
    Returns
    Type Description
    bool
    Remarks

    A culture becomes available whenever the content name for this culture is non-null, and it becomes unavailable whenever the content name is null.

    Returns false for the invariant culture, in order to be consistent with AvailableCultures, even though the invariant culture is always available.

    Does not support the '*' wildcard (returns false).

    View Source

    RemoveValue(string)

    Removes a Property value.

    Declaration
    void RemoveValue(string propertyTypeAlias)
    Parameters
    Type Name Description
    string propertyTypeAlias

    The alias of the property value to remove.

    Remarks

    This removes the value for all cultures and segments.

    View Source

    SetCultureName(string?, string?)

    Sets the name of the content item for a specified culture.

    Declaration
    void SetCultureName(string? value, string? culture)
    Parameters
    Type Name Description
    string value
    string culture
    Remarks

    When culture is null, sets the invariant culture name, which sets the Name property.

    When culture is not null, throws if the content type does not vary by culture.

    View Source

    SetValue(string, object?, string?, string?)

    Sets the (edited) value of a Property

    Declaration
    void SetValue(string propertyTypeAlias, object? value, string? culture = null, string? segment = null)
    Parameters
    Type Name Description
    string propertyTypeAlias
    object value
    string culture
    string segment
    Remarks

    Values 'null' and 'empty' are equivalent for culture and segment.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX