Class EntityBase
Provides a base class for entities.
Namespace: Umbraco.Cms.Core.Models.Entities
Assembly: Umbraco.Core.dll
Syntax
[Serializable]
[DataContract(IsReference = true)]
public abstract class EntityBase : BeingDirtyBase, IRememberBeingDirty, ICanBeDirty, IEntity, IDeepCloneable
Properties
View SourceCreateDate
Gets or sets the creation date.
Declaration
[DataMember]
public DateTime CreateDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime |
DeleteDate
Gets or sets the delete date.
Declaration
[DataMember]
public DateTime? DeleteDate { get; set; }
Property Value
| Type | Description |
|---|---|
| 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).
HasIdentity
Gets a value indicating whether the entity has an identity.
Declaration
[DataMember]
public virtual bool HasIdentity { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Id
Gets or sets the integer identifier of the entity.
Declaration
[DataMember]
public int Id { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Key
Gets or sets the Guid unique identifier of the entity.
Declaration
[DataMember]
public Guid Key { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid |
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 |
|---|---|
| object |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Equals(EntityBase?)
Declaration
public virtual bool Equals(EntityBase? other)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityBase | other |
Returns
| Type | Description |
|---|---|
| bool |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
PerformDeepClone(object)
Used by inheritors to modify the DeepCloning logic
Declaration
protected virtual void PerformDeepClone(object clone)
Parameters
| Type | Name | Description |
|---|---|---|
| object | clone |
ResetIdentity()
Resets the entity identity.
Declaration
public virtual void ResetIdentity()