Class Content
Represents a Content object
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
[DataContract(IsReference = true)]
public class Content : PublishableContentBase, IContent, IPublishableContentBase, IContentBase, IUmbracoEntity, ITreeEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty, ITemplatedContent
Constructors
View SourceContent(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. |
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. |
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. |
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. |
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. |
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 SourceBlueprint
Declaration
[DataMember]
public bool Blueprint { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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.
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 SourceDeepCloneWithResetIdentities()
Creates a deep clone of the current entity with its identity/alias and it's property identities reset
Declaration
public IContent DeepCloneWithResetIdentities()
Returns
| Type | Description |
|---|---|
| IContent |