SoftDeletableEntity
Class abstractpublic
Base class for entities that support soft deletion in addition to audit tracking.
Definition
Section titled Definitionpublic abstract class SoftDeletableEntity : SampleApi.AuditableEntityInheritance
Section titled InheritanceclassDiagram
direction TB
class SoftDeletableEntity {
<<abstract>>
}
class AuditableEntity {
<<abstract>>
}
AuditableEntity <|-- SoftDeletableEntityRemarks
Section titled RemarksEntities derived from SoftDeletableEntity are never physically removed from the data store. Instead, the
IsDeleted flag is set to true and DeletedAt records the time of deletion. Query logic should filter out soft-deleted entities by default.Properties3
Section titled PropertiesDateTimeOffset? DateTimeOffset? SoftDeletableEntity.DeletedAtGets or sets the UTC date and time when the entity was soft-deleted.
string? string? SoftDeletableEntity.DeletedByGets or sets the identifier of the user who deleted the entity.
IsDeleted Section titled IsDeleted bool bool SoftDeletableEntity.IsDeletedGets or sets a value indicating whether the entity has been soft-deleted.
Methods2
Section titled MethodsRestore Section titled Restore void SoftDeletableEntity.Restore()Restores a previously soft-deleted entity, clearing deletion metadata.
SoftDelete Section titled SoftDelete void SoftDeletableEntity.SoftDelete( string? deletedBy = null)Marks the entity as deleted by setting IsDeleted to true and recording the current UTC time and the identity of the user performing the deletion.
Parameters
deletedBy string? optional The identifier of the user performing the deletion.