Table of Contents

Class SoftDeleteAttribute

Namespace
CL.MySQL2.Models
Assembly
CL.MySQL2.dll

Marks an entity for soft deletes. DeleteAsync(object, CancellationToken) sets the named timestamp column to the current UTC time instead of issuing a physical DELETE, and reads through mysql.Query<T>() and the repository getters automatically exclude rows where that column is set (WHERE col IS NULL). Opt back in to deleted rows with .IncludeDeleted() on a query, or purge for real with HardDeleteAsync(object, CancellationToken).

The referenced property must be a nullable DateTime mapped to a NULL-able DATETIME column. Auto soft-delete filtering applies to single-table queries and repository reads — not to joins, subqueries, or bulk UpdateAsync/DeleteAsync on the query builder.

[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class SoftDeleteAttribute : Attribute
Inheritance
SoftDeleteAttribute
Inherited Members

Constructors

SoftDeleteAttribute(string)

public SoftDeleteAttribute(string timestampColumn)

Parameters

timestampColumn string

Property name of the nullable DateTime soft-delete column.

Properties

TimestampColumn

Property name holding the soft-delete timestamp (a nullable DateTime), e.g. nameof(DeletedUtc).

public string TimestampColumn { get; }

Property Value

string