Class RetainDaysAttribute
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
daysintRetain rows for this many days.
timestampColumnstringProperty 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
Days
Rows older than this many days are deleted.
public int Days { get; }
Property Value
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; }