Class Content
Represents a Content object
Namespace: Umbraco.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 SourceContent(String, Int32, IContentType, String)
Constructor for creating a Content object
Declaration
public Content(string name, int parentId, IContentType contentType, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the content |
System.Int32 | parentId | Id of the Parent content |
IContentType | contentType | ContentType for the current Content object |
System.String | culture | An optional culture. |
Content(String, Int32, 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 |
---|---|---|
System.String | name | Name of the content |
System.Int32 | parentId | Id of the Parent content |
IContentType | contentType | ContentType for the current Content object |
PropertyCollection | properties | Collection of properties |
System.String | culture | An optional culture. |
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 |
---|---|---|
System.String | name | Name of the content |
IContent | parent | Parent IContent object |
IContentType | contentType | ContentType for the current Content object |
System.String | culture | An optional culture. |
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 |
---|---|---|
System.String | name | Name of the content |
IContent | parent | Parent IContent object |
IContentType | contentType | ContentType for the current Content object |
PropertyCollection | properties | Collection of properties |
System.String | culture | An optional culture. |
Properties
View SourceBlueprint
Declaration
[DataMember]
public bool Blueprint { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ContentSchedule
Gets or sets the content schedule
Declaration
public ContentScheduleCollection ContentSchedule { get; set; }
Property Value
Type | Description |
---|---|
ContentScheduleCollection |
Edited
Declaration
[IgnoreDataMember]
public bool Edited { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EditedCultures
Gets the edited cultures.
Declaration
[IgnoreDataMember]
public IEnumerable<string> EditedCultures { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
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.
PublishDate
Gets the date and time the content was published.
Declaration
[IgnoreDataMember]
public DateTime? PublishDate { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
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 |
---|---|
System.Boolean |
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
PublishedCultures
Gets the published cultures.
Declaration
[IgnoreDataMember]
public IEnumerable<string> PublishedCultures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
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.
PublishedVersionId
Declaration
[IgnoreDataMember]
public int PublishedVersionId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PublisherId
Gets the identifier of the user who published the content.
Declaration
[IgnoreDataMember]
public int? PublisherId { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
PublishName
Gets the name of the published version of the content.
Declaration
[IgnoreDataMember]
public string PublishName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
When editing the content, the name can change, but this will not until the content is published.
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 |
---|---|
System.Nullable<System.Int32> |
Remarks
When editing the content, the template can change, but this will not until the content is published.
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 |
---|---|
System.Nullable<System.Int32> |
Remarks
If no template is explicitly set on the Content object, the Default template from the ContentType will be returned.
Methods
View SourceDeepCloneWithResetIdentities()
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 |
GetPublishDate(String)
Gets the date a culture was published.
Declaration
public DateTime? GetPublishDate(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> |
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 |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
System.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.
IsCultureEdited(String)
Gets a value indicated whether a given culture is edited.
Declaration
public bool IsCultureEdited(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
System.Boolean |
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).
IsCulturePublished(String)
Gets a value indicating whether a culture is published.
Declaration
public bool IsCulturePublished(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
System.Boolean |
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).
IsPropertyDirty(String)
Determines whether a specific property is dirty.
Declaration
public override bool IsPropertyDirty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Overridden to check special keys.
PerformDeepClone(Object)
Declaration
protected override void PerformDeepClone(object clone)
Parameters
Type | Name | Description |
---|---|---|
System.Object | clone |
ResetDirtyProperties(Boolean)
Declaration
public override void ResetDirtyProperties(bool rememberDirty)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | rememberDirty |
ResetWereDirtyProperties()
Declaration
public override void ResetWereDirtyProperties()
WasPropertyDirty(String)
Determines whether a specific property was dirty.
Declaration
public override bool WasPropertyDirty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Overridden to check special keys.