Alvecta.Foundation.Domain.ValueObjects
6.3.63
See the version list below for details.
dotnet add package Alvecta.Foundation.Domain.ValueObjects --version 6.3.63
NuGet\Install-Package Alvecta.Foundation.Domain.ValueObjects -Version 6.3.63
<PackageReference Include="Alvecta.Foundation.Domain.ValueObjects" Version="6.3.63" />
<PackageVersion Include="Alvecta.Foundation.Domain.ValueObjects" Version="6.3.63" />
<PackageReference Include="Alvecta.Foundation.Domain.ValueObjects" />
paket add Alvecta.Foundation.Domain.ValueObjects --version 6.3.63
#r "nuget: Alvecta.Foundation.Domain.ValueObjects, 6.3.63"
#:package Alvecta.Foundation.Domain.ValueObjects@6.3.63
#addin nuget:?package=Alvecta.Foundation.Domain.ValueObjects&version=6.3.63
#tool nuget:?package=Alvecta.Foundation.Domain.ValueObjects&version=6.3.63
Alvecta.Foundation.Domain.ValueObjects
The base type for single-value value objects: SimpleValueObject<T>, a record that wraps one
comparable primitive (string, Guid, int, DateTimeOffset, ...) and gives it a name in the
domain vocabulary.
It belongs to the Domain.ValueObjects layer, the innermost layer of the Alvecta Clean Architecture conventions: every other layer may reference it, and it references nothing. The package has no dependencies.
What it gives you
- Value equality — two
ShopName("acme")instances are equal, as with any record. - Ordering —
IComparable<SimpleValueObject<T>>plus<,<=,>,>=, delegating to the wrapped value;nullsorts first. - A plain
ToString()— returns the wrapped value (sealed, so a subclass cannot change it). - No bypassing the constructor —
Valueis get-only with noinitaccessor, sowith { Value = ... }does not compile and a copy cannot skip the invariants the constructor enforces.
Usage
dotnet add package Alvecta.Foundation.Domain.ValueObjects
Derive one record per domain value and validate in the constructor:
using Alvecta.Foundation.Domain.ValueObjects;
public sealed record ShopName : SimpleValueObject<string>
{
public ShopName(string value)
: base(value)
{
ArgumentException.ThrowIfNullOrWhiteSpace(value);
}
}
var acme = new ShopName("acme");
bool same = acme == new ShopName("acme"); // true
bool before = acme < new ShopName("zeta"); // true
string text = acme.ToString(); // "acme"
When the value comes from untrusted input, keep the constructor internal and offer a static
Parse method that returns errors instead of throwing (the IParsableValueObject pattern from
Alvecta.Utils.Parsing).
To persist value objects with EF Core, register SimpleValueObjectValueConverter<TValueObject, TWrapped>
from Alvecta.Foundation.Infrastructure.EF. It also binds an internal constructor.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Alvecta.Foundation.Domain.ValueObjects:
| Package | Downloads |
|---|---|
|
Alvecta.Foundation.Infrastructure.EF
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.67 | 0 | 10/20/2026 |
| 7.0.66 | 44 | 10/19/2026 |
| 7.0.65 | 39 | 10/19/2026 |
| 6.3.64 | 47 | 10/19/2026 |
| 6.3.63 | 47 | 10/19/2026 |
| 6.2.62 | 83 | 10/14/2026 |
| 6.1.61 | 118 | 10/9/2026 |
| 6.1.60 | 120 | 10/7/2026 |
| 6.1.59 | 118 | 10/6/2026 |
| 6.1.58 | 120 | 10/5/2026 |
| 6.0.57 | 128 | 10/2/2026 |
| 6.0.56 | 119 | 10/1/2026 |
| 6.0.55 | 134 | 10/1/2026 |
| 5.0.54 | 136 | 9/30/2026 |
| 5.0.53 | 126 | 9/28/2026 |
| 5.0.52 | 134 | 9/17/2026 |
| 5.0.51 | 135 | 9/17/2026 |
| 5.0.50 | 138 | 9/17/2026 |
| 5.0.49 | 135 | 9/17/2026 |
| 5.0.48 | 126 | 9/17/2026 |