Alvecta.Foundation.Domain.ValueObjects 6.3.63

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alvecta.Foundation.Domain.ValueObjects" Version="6.3.63" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alvecta.Foundation.Domain.ValueObjects" Version="6.3.63" />
                    
Directory.Packages.props
<PackageReference Include="Alvecta.Foundation.Domain.ValueObjects" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Alvecta.Foundation.Domain.ValueObjects --version 6.3.63
                    
#r "nuget: Alvecta.Foundation.Domain.ValueObjects, 6.3.63"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Alvecta.Foundation.Domain.ValueObjects@6.3.63
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Alvecta.Foundation.Domain.ValueObjects&version=6.3.63
                    
Install as a Cake Addin
#tool nuget:?package=Alvecta.Foundation.Domain.ValueObjects&version=6.3.63
                    
Install as a Cake Tool

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; null sorts first.
  • A plain ToString() — returns the wrapped value (sealed, so a subclass cannot change it).
  • No bypassing the constructor — Value is get-only with no init accessor, so with { 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
Loading failed