Class ContentType
Represents the content type that a Content object is based on
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
[Serializable]
[DataContract(IsReference = true)]
public class ContentType : ContentTypeCompositionBase, IContentType, IContentTypeComposition, IContentTypeBase, IUmbracoEntity, IAggregateRoot, IDeletableEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty
Constructors
ContentType(Int32)
Constuctor for creating a ContentType with the parent's id.
Declaration
public ContentType(int parentId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId |
Remarks
Only use this for creating ContentTypes at the root (with ParentId -1).
ContentType(IContentType)
Constuctor for creating a ContentType with the parent as an inherited type.
Declaration
[Obsolete("This method is obsolete, use ContentType(IContentType parent, string alias) instead.", false)]
public ContentType(IContentType parent)
Parameters
Type | Name | Description |
---|---|---|
IContentType | parent |
Remarks
Use this to ensure inheritance from parent.
ContentType(IContentType, String)
Constuctor for creating a ContentType with the parent as an inherited type.
Declaration
public ContentType(IContentType parent, string alias)
Parameters
Type | Name | Description |
---|---|---|
IContentType | parent | |
System.String | alias |
Remarks
Use this to ensure inheritance from parent.
Properties
AllowedTemplates
Gets or Sets a list of Templates which are allowed for the ContentType TODO: This should be ignored from cloning!!!!!!!!!!!!!!
- but to do that we have to implement callback hacks, this needs to be fixed in v8, we should not store direct entity
Declaration
[DataMember]
public IEnumerable<ITemplate> AllowedTemplates { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITemplate> |
DefaultTemplate
Gets or sets the alias of the default Template. TODO: This should be ignored from cloning!!!!!!!!!!!!!!
- but to do that we have to implement callback hacks, this needs to be fixed in v8, we should not store direct entity
Declaration
[IgnoreDataMember]
public ITemplate DefaultTemplate { get; }
Property Value
Type | Description |
---|---|
ITemplate |
Methods
Clone(String)
Creates a deep clone of the current entity with its identity/alias and it's property identities reset
Declaration
[Obsolete("Use DeepCloneWithResetIdentities instead")]
public IContentType Clone(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias |
Returns
Type | Description |
---|---|
IContentType |
DeepCloneWithResetIdentities(String)
Creates a deep clone of the current entity with its identity/alias and it's property identities reset
Declaration
public IContentType DeepCloneWithResetIdentities(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias |
Returns
Type | Description |
---|---|
IContentType |
RemoveTemplate(ITemplate)
Removes a template from the list of allowed templates
Declaration
public bool RemoveTemplate(ITemplate template)
Parameters
Type | Name | Description |
---|---|---|
ITemplate | template | ITemplate to remove |
Returns
Type | Description |
---|---|
System.Boolean | True if template was removed, otherwise False |
SetDefaultTemplate(ITemplate)
Sets the default template for the ContentType
Declaration
public void SetDefaultTemplate(ITemplate template)
Parameters
Type | Name | Description |
---|---|---|
ITemplate | template | Default ITemplate |