Class ContentTypeBase
Represents an abstract class for base ContentType properties and methods
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
[Serializable]
[DataContract(IsReference = true)]
public abstract class ContentTypeBase : Entity, IContentTypeBase, IUmbracoEntity, IAggregateRoot, IDeletableEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty
Constructors
ContentTypeBase(Int32)
Declaration
protected ContentTypeBase(int parentId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId |
ContentTypeBase(IContentTypeBase)
Declaration
protected ContentTypeBase(IContentTypeBase parent)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | parent |
ContentTypeBase(IContentTypeBase, String)
Declaration
protected ContentTypeBase(IContentTypeBase parent, string alias)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | parent | |
System.String | alias |
Properties
Alias
The Alias of the ContentType
Declaration
[DataMember]
public virtual string Alias { get; set; }
Property Value
Type | Description |
---|---|
System.String |
AllowedAsRoot
Gets or Sets a boolean indicating whether this ContentType is allowed at the root
Declaration
[DataMember]
public virtual bool AllowedAsRoot { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AllowedContentTypes
Gets or sets a list of integer Ids for allowed ContentTypes
Declaration
[DataMember]
public virtual IEnumerable<ContentTypeSort> AllowedContentTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ContentTypeSort> |
CreatorId
Gets or sets the Id of the user who created this ContentType
Declaration
[DataMember]
public virtual int CreatorId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Description
Description for the ContentType
Declaration
[DataMember]
public virtual string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Icon
Name of the icon (sprite class) used to identify the ContentType
Declaration
[DataMember]
public virtual string Icon { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsContainer
Gets or Sets a boolean indicating whether this ContentType is a Container
Declaration
[DataMember]
public virtual bool IsContainer { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
ContentType Containers doesn't show children in the tree, but rather in grid-type view.
Level
Gets or sets the level of the content entity
Declaration
[DataMember]
public virtual int Level { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
Gets or sets the name of the current entity
Declaration
[DataMember]
public virtual string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
NoGroupPropertyTypes
Gets or sets the property types that are not in a group.
Declaration
public IEnumerable<PropertyType> NoGroupPropertyTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PropertyType> |
ParentId
Gets or sets the Id of the Parent entity
Declaration
[DataMember]
public virtual int ParentId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Might not be necessary if handled as a relation?
Path
Gets of sets the path
Declaration
[DataMember]
public virtual string Path { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PropertyGroups
List of PropertyGroups available on this ContentType
Declaration
[DataMember]
public virtual PropertyGroupCollection PropertyGroups { get; set; }
Property Value
Type | Description |
---|---|
PropertyGroupCollection |
Remarks
A PropertyGroup corresponds to a Tab in the UI
PropertyTypes
Gets all property types, across all property groups.
Declaration
[IgnoreDataMember]
public virtual IEnumerable<PropertyType> PropertyTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PropertyType> |
SortOrder
Gets or sets the sort order of the content entity
Declaration
[DataMember]
public virtual int SortOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Thumbnail
Name of the thumbnail used to identify the ContentType
Declaration
[DataMember]
public virtual string Thumbnail { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Trashed
Boolean indicating whether this ContentType is Trashed or not. If ContentType is Trashed it will be located in the Recyclebin.
Declaration
[DataMember]
public virtual bool Trashed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
AddPropertyGroup(String)
Adds a PropertyGroup. This method will also check if a group already exists with the same name and link it to the parent.
Declaration
public abstract bool AddPropertyGroup(string groupName)
Parameters
Type | Name | Description |
---|---|---|
System.String | groupName | Name of the PropertyGroup to add |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
AddPropertyType(PropertyType)
Adds a PropertyType, which does not belong to a PropertyGroup.
Declaration
public bool AddPropertyType(PropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | PropertyType to add |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
AddPropertyType(PropertyType, String)
Adds a PropertyType to a specific PropertyGroup
Declaration
public abstract bool AddPropertyType(PropertyType propertyType, string propertyGroupName)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | PropertyType to add |
System.String | propertyGroupName | Name of the PropertyGroup to add the PropertyType to |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
DeepClone()
Declaration
public override object DeepClone()
Returns
Type | Description |
---|---|
System.Object |
IsDirty()
Indicates whether the current entity is dirty.
Declaration
public override bool IsDirty()
Returns
Type | Description |
---|---|
System.Boolean | True if entity is dirty, otherwise False |
IsPropertyDirty(String)
Indicates whether a specific property on the current IContent entity is dirty.
Declaration
public override bool IsPropertyDirty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property to check |
Returns
Type | Description |
---|---|
System.Boolean | True if Property is dirty, otherwise False |
MovePropertyType(String, String)
Moves a PropertyType to a specified PropertyGroup
Declaration
public bool MovePropertyType(string propertyTypeAlias, string propertyGroupName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType to move |
System.String | propertyGroupName | Name of the PropertyGroup to move the PropertyType to |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
If propertyGroupName is null then the property is moved back to "generic properties" ie does not have a tab anymore.
PropertyGroupsChanged(Object, NotifyCollectionChangedEventArgs)
Declaration
protected void PropertyGroupsChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e |
PropertyTypeExists(String)
Checks whether a PropertyType with a given alias already exists
Declaration
public abstract bool PropertyTypeExists(string propertyTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
PropertyTypesChanged(Object, NotifyCollectionChangedEventArgs)
Declaration
protected void PropertyTypesChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e |
RemovePropertyGroup(String)
Removes a PropertyGroup from the current ContentType
Declaration
public void RemovePropertyGroup(string propertyGroupName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyGroupName | Name of the PropertyGroup to remove |
RemovePropertyType(String)
Removes a PropertyType from the current ContentType
Declaration
public void RemovePropertyType(string propertyTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType to remove |
ResetDirtyProperties()
Resets dirty properties by clearing the dictionary used to track changes.
Declaration
public override void ResetDirtyProperties()
Remarks
Please note that resetting the dirty properties could potentially obstruct the saving of a new or updated entity.
SetLazyParentId(Lazy<Int32>)
Sets the ParentId from the lazy integer id
Declaration
public void SetLazyParentId(Lazy<int> id)
Parameters
Type | Name | Description |
---|---|---|
System.Lazy<System.Int32> | id | Id of the Parent |
Explicit Interface Implementations
IUmbracoEntity.AdditionalData
Some entities may expose additional data that other's might not, this custom data will be available in this collection
Declaration
IDictionary<string, object> IUmbracoEntity.AdditionalData { get; }
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |