Table of Contents

Class RetainDaysAttribute

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

Declares a retention policy for the annotated entity. The library's background purge worker periodically deletes rows whose TimestampColumn is older than Days. Replaces hand-rolled cleanup jobs.

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

Constructors

RetainDaysAttribute(int, string)

public RetainDaysAttribute(int days, string timestampColumn)

Parameters

days int

Retain rows for this many days.

timestampColumn string

Property name holding the timestamp to compare.

Properties

BatchSize

How many rows to delete per batch. Keeps the delete transaction small. Default: 5000.

public int BatchSize { get; set; }

Property Value

int

Days

Rows older than this many days are deleted.

public int Days { get; }

Property Value

int

TimestampColumn

The property name on the entity that holds the timestamp to compare (e.g. nameof(FooRecord.CreatedUtc)). Must map to a DATETIME column.

public string TimestampColumn { get; }

Property Value

string