Class EntitySlim
Implementation of IEntitySlim for internal use.
Inheritance
Namespace: Umbraco.Cms.Core.Models.Entities
Assembly: Umbraco.Core.dll
Syntax
public class EntitySlim : IEntitySlim, IUmbracoEntity, ITreeEntity, IEntity, IDeepCloneable, IHaveAdditionalData
Remarks
Although it implements IEntitySlim, this class does not implement IRememberBeingDirty and everything this interface defines, throws.
Although it implements IEntitySlim, this class does not implement IDeepCloneable and deep-cloning throws.
Fields
View SourceRoot
Gets an entity representing "root".
Declaration
public static readonly IEntitySlim Root
Field Value
Type | Description |
---|---|
IEntitySlim |
Properties
View SourceAdditionalData
Gets additional data for this entity.
Declaration
[DataMember]
public IDictionary<string, object>? AdditionalData { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IDictionary<System.String, System.Object>> |
Remarks
Can be empty, but never null. To avoid allocating, do not test for emptiness, but use HasAdditionalData instead.
CreateDate
Gets or sets the creation date.
Declaration
[DataMember]
public DateTime CreateDate { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
CreatorId
Gets or sets the identifier of the user who created this entity.
Declaration
[DataMember]
public int CreatorId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DeleteDate
Gets or sets the delete date.
Declaration
[DataMember]
public DateTime? DeleteDate { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<DateTime> |
Remarks
The delete date is null when the entity has not been deleted.
The delete date has a value when the entity instance has been deleted, but this value is transient and not persisted in database (since the entity does not exist anymore).
HasAdditionalData
Determines whether this entity has additional data.
Declaration
[IgnoreDataMember]
public bool HasAdditionalData { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Use this property to check for additional data without getting AdditionalData, to avoid allocating.
HasChildren
Gets or sets a value indicating whether the entity has children.
Declaration
[DataMember]
public bool HasChildren { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasIdentity
Gets a value indicating whether the entity has an identity.
Declaration
[DataMember]
public bool HasIdentity { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Id
Gets or sets the integer identifier of the entity.
Declaration
[DataMember]
public int Id { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsContainer
Gets a value indicating whether the entity is a container.
Declaration
[DataMember]
public virtual bool IsContainer { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Key
Gets or sets the Guid unique identifier of the entity.
Declaration
[DataMember]
public Guid Key { get; set; }
Property Value
Type | Description |
---|---|
Guid |
Level
Gets or sets the level of the entity.
Declaration
[DataMember]
public int Level { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
Gets or sets the name of the entity.
Declaration
[DataMember]
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
NodeObjectType
Gets or sets the entity object type.
Declaration
[DataMember]
public Guid NodeObjectType { get; set; }
Property Value
Type | Description |
---|---|
Guid |
ParentId
Gets or sets the identifier of the parent entity.
Declaration
[DataMember]
public int ParentId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Path
Gets or sets the path to the entity.
Declaration
[DataMember]
public string Path { get; set; }
Property Value
Type | Description |
---|---|
System.String |
SortOrder
Gets or sets the sort order of the entity.
Declaration
[DataMember]
public int SortOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Trashed
Gets a value indicating whether this entity is trashed.
Declaration
[DataMember]
public bool Trashed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Trashed entities are located in the recycle bin.
Always false for entities that do not support being trashed.
UpdateDate
Gets or sets the last update date.
Declaration
[DataMember]
public DateTime UpdateDate { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
Methods
View SourceDeepClone()
Declaration
public object DeepClone()
Returns
Type | Description |
---|---|
System.Object |
GetDirtyProperties()
Declaration
public IEnumerable<string> GetDirtyProperties()
Returns
Type | Description |
---|---|
IEnumerable<System.String> |
GetWereDirtyProperties()
Declaration
public IEnumerable<string> GetWereDirtyProperties()
Returns
Type | Description |
---|---|
IEnumerable<System.String> |
IsDirty()
Declaration
public bool IsDirty()
Returns
Type | Description |
---|---|
System.Boolean |
IsPropertyDirty(String)
Declaration
public bool IsPropertyDirty(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName |
Returns
Type | Description |
---|---|
System.Boolean |
ResetDirtyProperties()
Declaration
public void ResetDirtyProperties()
ResetDirtyProperties(Boolean)
Declaration
public void ResetDirtyProperties(bool rememberDirty)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | rememberDirty |
ResetIdentity()
Declaration
public void ResetIdentity()
ResetWereDirtyProperties()
Declaration
public void ResetWereDirtyProperties()
SetParent(ITreeEntity)
Sets the parent entity.
Declaration
public void SetParent(ITreeEntity parent)
Parameters
Type | Name | Description |
---|---|---|
ITreeEntity | parent |
Remarks
Use this method to set the parent entity when the parent entity is known, but has not been persistent and does not yet have an identity. The parent identifier will be retrieved from the parent entity when needed. If the parent entity still does not have an entity by that time, an exception will be thrown by ParentId getter.
WasDirty()
Declaration
public bool WasDirty()
Returns
Type | Description |
---|---|
System.Boolean |
WasPropertyDirty(String)
Declaration
public bool WasPropertyDirty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
System.Boolean |