Table of Contents

Class DurationAttribute

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Declares how a TimeSpan property is stored. On a provider with a native duration type (PostgreSQL interval, MySQL/MariaDB TIME) the unit is ignored and the value is stored natively; on a provider without one (SQL Server, SQLite, ClickHouse) the value is stored in an integer column in Unit, defaulting to Ticks.

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class DurationAttribute : Attribute
Inheritance
DurationAttribute
Inherited Members
Extension Methods

Remarks

The attribute is read by IPropertyMetadata (DurationUnit) and by the dialect's MakeDurationType hook. The concrete member is TimeSpan; the equivalent fluent mapping is Duration(DurationUnit, int).

Constructors

DurationAttribute()

Creates an attribute that stores the value in Ticks.

public DurationAttribute()

DurationAttribute(DurationUnit)

Creates an attribute that stores the value in unit.

public DurationAttribute(DurationUnit unit)

Parameters

unit DurationUnit

The unit of the stored integer value on providers without a native duration type.

Properties

Precision

The precision of the native duration type (fractional seconds), for example TIME(3) or interval(3). Zero means the provider default.

public int Precision { get; set; }

Property Value

int

Unit

The unit of the stored integer value on providers without a native duration type.

public DurationUnit Unit { get; set; }

Property Value

DurationUnit