Skip to main content
Version: 0.3.x (0.3.0)

Class ValueObjectCheckOptions

Namespace: AdCodicem.ValueObjects.EntityFrameworkCore
Assembly: AdCodicem.ValueObjects.EntityFrameworkCore.dll

Chooses the rules writes as CHECK constraints, and the dialect it writes a pattern in.

public sealed class ValueObjectCheckOptions

Inheritance​

object ← ValueObjectCheckOptions

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties​

Patterns​

Gets or sets the dialect of regular expressions the database runs, which a pattern is written in: none by default, so that no pattern is written.

public ValueObjectPatternDialect Patterns { get; set; }

Property Value​

ValueObjectPatternDialect

Remarks​

The model cannot tell which dialect the database runs, the compatibility level of a SQL Server database least of all, so it is stated. A dialect that does not match the provider at hand, PostgreSQL's under SQLite in tests, writes no pattern; SQLite has no regular expressions.

Naming one checks the pattern of each column the convention constrains when the model is built, under SQLite, or the provider of the other dialect, as under the database it names: a pattern holding a construct the dialect reads apart from .NET, or whose regular expression sets any option but CultureInvariant, Compiled, ExplicitCapture and NonBacktracking, which its text does not carry, IgnoreCase say, or ECMAScript and RightToLeft, which VO0025 does not report, fails the model with an naming the value object, the construct or the option, and the dialect, unless leaves that value object out. A pattern a value object written by hand states in its schema alone is checked from its text alone. Another provider than SQL Server, PostgreSQL and SQLite gets no constraint, and no check.

Rules​

Gets or sets the rules written as CHECK constraints: lengths, bounds and closed value sets, unless one is removed.

public ValueObjectChecks Rules { get; set; }

Property Value​

ValueObjectChecks

Methods​

ExcludePattern<TSelf>()​

Leaves the pattern of a value object out of the constraints, and out of the check of , its other rules being written as before.

public ValueObjectCheckOptions ExcludePattern<TSelf>() where TSelf : struct, IValueObject<TSelf, string>

Returns​

ValueObjectCheckOptions

The same options, so calls can be chained.

Type Parameters​

TSelf

The value object, over ; a construction of a generic one is left out alone.

Remarks​

For a value object whose pattern the dialect would read apart from .NET, an email address's [^@\s] say, which would otherwise fail the model: the database then checks its length, as before, and the application its pattern.