NonEmptyUniqueAttribute

Ecng.Serialization

A partial unique index that ignores rows whose LAST key column holds the empty string — the common "unique per scope, but only for rows that actually carry a key" case (e.g. an idempotency key defaulting to empty). Equivalent to [Unique(fields…)] with Condition = "{lastField} <> ''", but typed and named so the raw predicate lives here once instead of as a string literal on every entity. For any other filter use the general Condition directly.

Inherits: UniqueAttribute

Constructors

NonEmptyUniqueAttribute
public NonEmptyUniqueAttribute(string fieldName)
nonEmptyUniqueAttribute = NonEmptyUniqueAttribute(fieldName)

Declares the unique index over , filtered to rows whose column is non-empty.

NonEmptyUniqueAttribute
public NonEmptyUniqueAttribute(string[] fieldNames)
nonEmptyUniqueAttribute = NonEmptyUniqueAttribute(fieldNames)

Declares the unique index over , filtered to rows whose last column is non-empty. Scope columns come first, the value-carrying key last.