ColumnOverrideAttribute

Ecng.Serialization

Overrides column-level metadata for a column the declaring site does not own outright. On a property, it names an inner property of a flattened inner schema type, so the outer property can shape individual inner columns.On an entity type, it names one of that entity's columns — including a column declared on a base class, which no property-level attribute on the derived type could reach. This mirrors the type-level IndexAttribute declarations, which name their columns by string for the same reason. An entity-level override wins over whatever the property itself declares.

Inherits: Attribute

Constructors

ColumnOverrideAttribute
public ColumnOverrideAttribute(string propertyName)
columnOverrideAttribute = ColumnOverrideAttribute(propertyName)

Overrides column-level metadata for a column the declaring site does not own outright. On a property, it names an inner property of a flattened inner schema type, so the outer property can shape individual inner columns.On an entity type, it names one of that entity's columns — including a column declared on a base class, which no property-level attribute on the derived type could reach. This mirrors the type-level IndexAttribute declarations, which name their columns by string for the same reason. An entity-level override wins over whatever the property itself declares.

propertyName
The property name whose column this override applies to.

Properties

IsNullable
public bool IsNullable { get; set; }
value = columnOverrideAttribute.IsNullable
columnOverrideAttribute.IsNullable = value

Gets or sets whether the column allows NULL values.

IsNullableSet
public bool IsNullableSet { get; }
value = columnOverrideAttribute.IsNullableSet

Gets whether IsNullable was explicitly set.

MaxLength
public int MaxLength { get; set; }
value = columnOverrideAttribute.MaxLength
columnOverrideAttribute.MaxLength = value

Gets or sets the maximum length for a string/binary column. 0 (the default) leaves the column's own MaxLength in place. A positive value replaces it, and Max replaces it with the dialect-specific unbounded type, as on ColumnAttribute. Applies only to string and byte[] columns.

Precision
public int Precision { get; set; }
value = columnOverrideAttribute.Precision
columnOverrideAttribute.Precision = value

Gets or sets the numeric precision for a decimal/numeric column, or the fractional-second digits for a date/time column. 0 (the default) leaves the column's own Precision and Scale in place. A non-zero value replaces both: Scale is then taken literally, so 0 means no digits after the point, as in DECIMAL(p).

PropertyName
public string PropertyName { get; }
value = columnOverrideAttribute.PropertyName

Gets the inner property name this override applies to.

Scale
public int Scale { get; set; }
value = columnOverrideAttribute.Scale
columnOverrideAttribute.Scale = value

Gets or sets the numeric scale for a decimal/numeric column. With Precision set, it is taken literally. Without it, 0 (the default) leaves the column's own scale in place, and any other value replaces that scale while the precision stays the column's own, or the dialect default when the column declares none.