Search Results for

    Show / Hide Table of Contents
    View Source

    Class Content

    Represents a Content object

    Inheritance
    object
    BeingDirtyBase
    EntityBase
    TreeEntityBase
    ContentBase
    Namespace: Umbraco.Cms.Core.Models
    Assembly: Umbraco.Core.dll
    Syntax
    [Serializable]
    [DataContract(IsReference = true)]
    public class Content : ContentBase, IContent, IContentBase, IUmbracoEntity, ITreeEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty

    Constructors

    View Source

    Content(string, int, IContentType, int, string?)

    Constructor for creating a Content object

    Declaration
    public Content(string name, int parentId, IContentType contentType, int userId, string? culture = null)
    Parameters
    Type Name Description
    string name

    Name of the content

    int parentId

    Id of the Parent content

    IContentType contentType

    ContentType for the current Content object

    int userId

    The identifier of the user creating the Content object

    string culture

    An optional culture.

    View Source

    Content(string?, int, IContentType?, string?)

    Constructor for creating a Content object

    Declaration
    public Content(string? name, int parentId, IContentType? contentType, string? culture = null)
    Parameters
    Type Name Description
    string name

    Name of the content

    int parentId

    Id of the Parent content

    IContentType contentType

    ContentType for the current Content object

    string culture

    An optional culture.

    View Source

    Content(string?, int, IContentType?, PropertyCollection, string?)

    Constructor for creating a Content object

    Declaration
    public Content(string? name, int parentId, IContentType? contentType, PropertyCollection properties, string? culture = null)
    Parameters
    Type Name Description
    string name

    Name of the content

    int parentId

    Id of the Parent content

    IContentType contentType

    ContentType for the current Content object

    PropertyCollection properties

    Collection of properties

    string culture

    An optional culture.

    View Source

    Content(string, IContent, IContentType, int, string?)

    Constructor for creating a Content object

    Declaration
    public Content(string name, IContent parent, IContentType contentType, int userId, string? culture = null)
    Parameters
    Type Name Description
    string name

    Name of the content

    IContent parent

    Parent IContent object

    IContentType contentType

    ContentType for the current Content object

    int userId

    The identifier of the user creating the Content object

    string culture

    An optional culture.

    View Source

    Content(string, IContent, IContentType, string?)

    Constructor for creating a Content object

    Declaration
    public Content(string name, IContent parent, IContentType contentType, string? culture = null)
    Parameters
    Type Name Description
    string name

    Name of the content

    IContent parent

    Parent IContent object

    IContentType contentType

    ContentType for the current Content object

    string culture

    An optional culture.

    View Source

    Content(string, IContent, IContentType, PropertyCollection, string?)

    Constructor for creating a Content object

    Declaration
    public Content(string name, IContent parent, IContentType contentType, PropertyCollection properties, string? culture = null)
    Parameters
    Type Name Description
    string name

    Name of the content

    IContent parent

    Parent IContent object

    IContentType contentType

    ContentType for the current Content object

    PropertyCollection properties

    Collection of properties

    string culture

    An optional culture.

    Properties

    View Source

    Blueprint

    Gets a value indicating whether the content item is a blueprint.

    Declaration
    [DataMember]
    public bool Blueprint { get; set; }
    Property Value
    Type Description
    bool
    View Source

    Edited

    Gets a value indicating whether the content has been edited.

    Declaration
    [IgnoreDataMember]
    public bool Edited { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Will return true once unpublished edits have been made after the version with PublishedVersionId has been published.

    View Source

    EditedCultures

    Gets the edited cultures.

    Declaration
    [IgnoreDataMember]
    public IEnumerable<string>? EditedCultures { get; set; }
    Property Value
    Type Description
    IEnumerable<string>
    View Source

    PublishCultureInfos

    Gets the published culture infos of the content.

    Declaration
    [IgnoreDataMember]
    public ContentCultureInfosCollection? PublishCultureInfos { get; set; }
    Property Value
    Type Description
    ContentCultureInfosCollection
    Remarks

    Because a dictionary key cannot be null this cannot get the invariant name, which must be get via the PublishName property.

    View Source

    PublishDate

    Gets the date and time the content was published.

    Declaration
    [IgnoreDataMember]
    public DateTime? PublishDate { get; set; }
    Property Value
    Type Description
    DateTime?
    View Source

    PublishName

    Gets the name of the published version of the content.

    Declaration
    [IgnoreDataMember]
    public string? PublishName { get; set; }
    Property Value
    Type Description
    string
    Remarks

    When editing the content, the name can change, but this will not until the content is published.

    View Source

    PublishTemplateId

    Gets the template id used to render the published version of the content.

    Declaration
    [IgnoreDataMember]
    public int? PublishTemplateId { get; set; }
    Property Value
    Type Description
    int?
    Remarks

    When editing the content, the template can change, but this will not until the content is published.

    View Source

    Published

    Gets or sets a value indicating whether this content item is published or not.

    Declaration
    [DataMember]
    public bool Published { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    the setter is should only be invoked from

    • the ContentFactory when creating a content entity from a dto
    • the ContentRepository when updating a content entity
    View Source

    PublishedCultures

    Gets the published cultures.

    Declaration
    [IgnoreDataMember]
    public IEnumerable<string> PublishedCultures { get; }
    Property Value
    Type Description
    IEnumerable<string>
    View Source

    PublishedState

    Gets the published state of the content item.

    Declaration
    [DataMember]
    public PublishedState PublishedState { get; set; }
    Property Value
    Type Description
    PublishedState
    Remarks

    The state should be Published or Unpublished, depending on whether Published is true or false, but can also temporarily be Publishing or Unpublishing when the content item is about to be saved.

    View Source

    PublishedVersionId

    Gets the version identifier for the currently published version of the content.

    Declaration
    [IgnoreDataMember]
    public int PublishedVersionId { get; set; }
    Property Value
    Type Description
    int
    View Source

    PublisherId

    Gets the identifier of the user who published the content.

    Declaration
    [IgnoreDataMember]
    public int? PublisherId { get; set; }
    Property Value
    Type Description
    int?
    View Source

    TemplateId

    Gets or sets the template used by the Content. This is used to override the default one from the ContentType.

    Declaration
    [DataMember]
    public int? TemplateId { get; set; }
    Property Value
    Type Description
    int?
    Remarks

    If no template is explicitly set on the Content object, the Default template from the ContentType will be returned.

    Methods

    View Source

    DeepCloneWithResetIdentities()

    Creates a deep clone of the current entity with its identity and it's property identities reset

    Declaration
    public IContent DeepCloneWithResetIdentities()
    Returns
    Type Description
    IContent
    View Source

    GetPublishDate(string)

    Gets the date a culture was published.

    Declaration
    public DateTime? GetPublishDate(string culture)
    Parameters
    Type Name Description
    string culture
    Returns
    Type Description
    DateTime?
    View Source

    GetPublishName(string?)

    Gets the name of the published version of the content for a given culture.

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

    When editing the content, the name can change, but this will not until the content is published.

    When culture is null, gets the invariant language, which is the value of the PublishName property.

    View Source

    IsCultureEdited(string)

    Gets a value indicated whether a given culture is edited.

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

    A culture is edited when it is available, and not published or published but with changes.

    A culture can be edited even though the document might now have been saved yet (and can have no identity).

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

    View Source

    IsCulturePublished(string)

    Gets a value indicating whether a culture is published.

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

    A culture becomes published whenever values for this culture are published, and the content published name for this culture is non-null. It becomes non-published whenever values for this culture are unpublished.

    A culture becomes published as soon as PublishCulture has been invoked, even though the document might not have been saved yet (and can have no identity).

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

    View Source

    IsPropertyDirty(string)

    Determines whether a specific property is dirty.

    Declaration
    public override bool IsPropertyDirty(string propertyName)
    Parameters
    Type Name Description
    string propertyName
    Returns
    Type Description
    bool
    Remarks

    Overridden to include user properties.

    View Source

    PerformDeepClone(object)

    Used by inheritors to modify the DeepCloning logic

    Declaration
    protected override void PerformDeepClone(object clone)
    Parameters
    Type Name Description
    object clone
    Remarks

    Overridden to deal with specific object instances

    View Source

    ResetDirtyProperties(bool)

    Resets dirty properties.

    Declaration
    public override void ResetDirtyProperties(bool rememberDirty)
    Parameters
    Type Name Description
    bool rememberDirty

    A value indicating whether to remember dirty properties.

    Remarks

    When rememberDirty is true, dirty properties are saved so they can be checked with WasDirty.

    View Source

    ResetWereDirtyProperties()

    Resets properties that were dirty.

    Declaration
    public override void ResetWereDirtyProperties()
    View Source

    WasPropertyDirty(string)

    Determines whether a specific property was dirty.

    Declaration
    public override bool WasPropertyDirty(string propertyName)
    Parameters
    Type Name Description
    string propertyName
    Returns
    Type Description
    bool
    Remarks

    A property was dirty if it had been changed and the changes were committed.

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