Table of Contents

Class DefaultValueAttribute

Namespace
eQuantic.Core.Data.Modeling
Assembly
eQuantic.Core.Data.Abstractions.dll

The value existing records take when this member is added to a model that is already in production.

On a relational store the column arrives with it as its default; on a document store it is written into the documents that predate the member. That second case is the one that bites: a document without the element does not fail to load, it loads as default(T) — an enum becomes its first value, a date becomes 0001-01-01 — so the data is quietly wrong rather than loudly missing.

The value belongs to the domain, not to the schema, which is why the engine will not invent one: a member added without it produces a change that refuses to run until you say what the existing records should hold.

[AttributeUsage(AttributeTargets.Property)]
public sealed class DefaultValueAttribute : Attribute
Inheritance
DefaultValueAttribute
Inherited Members

Constructors

DefaultValueAttribute(object)

The value existing records take when this member is added to a model that is already in production.

On a relational store the column arrives with it as its default; on a document store it is written into the documents that predate the member. That second case is the one that bites: a document without the element does not fail to load, it loads as default(T) — an enum becomes its first value, a date becomes 0001-01-01 — so the data is quietly wrong rather than loudly missing.

The value belongs to the domain, not to the schema, which is why the engine will not invent one: a member added without it produces a change that refuses to run until you say what the existing records should hold.

public DefaultValueAttribute(object value)

Parameters

value object

Properties

Value

The value existing records take.

public object Value { get; }

Property Value

object