Trellis.Primitives 3.0.0-alpha.304

This is a prerelease version of Trellis.Primitives.
dotnet add package Trellis.Primitives --version 3.0.0-alpha.304
                    
NuGet\Install-Package Trellis.Primitives -Version 3.0.0-alpha.304
                    
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="Trellis.Primitives" Version="3.0.0-alpha.304" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.Primitives" Version="3.0.0-alpha.304" />
                    
Directory.Packages.props
<PackageReference Include="Trellis.Primitives" />
                    
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 Trellis.Primitives --version 3.0.0-alpha.304
                    
#r "nuget: Trellis.Primitives, 3.0.0-alpha.304"
                    
#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 Trellis.Primitives@3.0.0-alpha.304
                    
#: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=Trellis.Primitives&version=3.0.0-alpha.304&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.Primitives&version=3.0.0-alpha.304&prerelease
                    
Install as a Cake Tool

Trellis.Primitives

NuGet Package

Strongly typed value objects for .NET, with built-in primitives like EmailAddress and Money plus composite JSON conversion and tracing registration for primitive value objects.

Installation

dotnet add package Trellis.Primitives

The Required*<TSelf> and ScalarValueObject<TSelf, TUnderlying> base classes live in Trellis.Core. The source generator, generated primitive JSON converter, and primitive trace source are bundled inside the Trellis.Core package (transitively referenced by Trellis.Primitives) — no extra package is required.

Quick Example

using Trellis;
using Trellis.Primitives;

// TryCreate returns Result<T>; pattern-match before using the value.
var emailResult = EmailAddress.TryCreate("ada@example.com");

// Money.Create throws on invalid input; use TryCreate for user input.
var subtotal = Money.Create(12.34m, "USD");
var shipping = Money.Create(2.00m, "USD");

// Arithmetic on Money returns Result<Money> (currency-mismatch / overflow safe).
Result<Money> grandTotal = subtotal.Add(shipping);

// Define a custom value object — the source generator emits TryCreate, equality, JSON converters, etc.
public sealed partial class CustomerEmail : RequiredString<CustomerEmail>;
public sealed partial class OrderId : RequiredGuid<OrderId>;

Key Features

  • Ready-to-use value objects for common concepts such as email, URL, money, and percentages.
  • Trellis.Core base classes like RequiredString<CustomerEmail> and RequiredGuid<OrderId> for custom domain types.
  • Validation and parsing rules that stay with the type instead of leaking into handlers and controllers.

Documentation

Part of Trellis

This package is part of the Trellis framework.

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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Trellis.Primitives:

Package Downloads
Trellis.EntityFrameworkCore

EF Core integration for Trellis. Convention-based value converter registration for Trellis primitives, Result-returning SaveChanges wrappers, Maybe/Result query extensions, and provider-agnostic database exception classification.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-alpha.304 61 5/29/2026
3.0.0-alpha.158 102 4/5/2026
3.0.0-alpha.157 67 4/4/2026
3.0.0-alpha.140 72 3/30/2026
3.0.0-alpha.137 79 3/27/2026
3.0.0-alpha.135 58 3/26/2026
3.0.0-alpha.127 74 3/23/2026
3.0.0-alpha.123 67 3/19/2026
3.0.0-alpha.118 74 3/14/2026
3.0.0-alpha.111 65 3/12/2026
3.0.0-alpha.104 86 3/9/2026
3.0.0-alpha.100 65 3/4/2026
3.0.0-alpha.99 59 3/4/2026
3.0.0-alpha.98 58 3/3/2026
3.0.0-alpha.95 63 3/2/2026
3.0.0-alpha.94 61 3/2/2026
3.0.0-alpha.93 60 3/1/2026
3.0.0-alpha.92 95 2/28/2026
3.0.0-alpha.83 64 2/27/2026