PineGuard.MustClauses 0.1.0-alpha.7

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

PineGuard.MustClauses

Validation that returns an answer, not an exception.

Must.Be.Email(value) gives you a MustResult<T>. Inspect it, compose it, or escalate it to whatever exception your domain speaks. PineGuard never throws on your behalf — your API layer, your call.

Use MustClauses anywhere the caller should decide what happens on failure — API endpoints returning 400 Bad Request, MediatR pipeline steps collecting multiple errors, services where failed validation isn't exceptional, and any Result-pattern architecture. It's also the composable primitive every other PineGuard layer is built on: Guard clauses, FluentValidation extensions, and DataAnnotations attributes all call into Must.Be.* under the hood.

One rule library. Every call site in your architecture. The same Must.Be.Email your services call powers Guard.Against.NotEmail in your domain constructors, RuleFor(x => x.Email).Email() in your validators, and [Email] on your DTOs. No parallel dialects. No drift. When the rule changes, every layer changes with it.

Install

dotnet add package PineGuard.MustClauses

Targets net8.0, net10.0, and netstandard2.1. Depends only on PineGuard.Core.

Examples

using PineGuard.MustClauses;

// The four canonical rules, result-style
MustResult<string> email       = Must.Be.Email(userEmail);
MustResult<string> strictEmail = Must.Be.StrictEmail(userEmail);
MustResult<string> safe        = Must.Be.OwaspSafe(userInput);
MustResult<Uri>    callbackUri = Must.Be.HttpsUrl(callback);

// Inspect the result
if (email.Failed)
    return BadRequest(email.Message);

// Or collapse to a value-or-throw in one line
var url = Must.Be.HttpsUrl(callback).OrThrow();

// Escalate with your own exception type
Must.Be.Email(userEmail).ThrowIfFailed((message, paramName) =>
    new BusinessException($"{paramName}: {message}"));

// Compose
var result = Must.Be.NotNull(orderId)
    .AndThen(id => Must.Be.GuidV4(id));

Other layers, same rule library

See the full documentation for the complete Must.Be.* catalog.

License

MIT © Steve McCormack

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on PineGuard.MustClauses:

Package Downloads
PineGuard.DataAnnotations

ValidationAttribute implementations for DTOs, MVC binding, and Blazor forms.

PineGuard.GuardClauses

Fail-fast guards with parsed typed returns. Guard.Against.NotHttpsUrl(url) returns a Uri or throws.

PineGuard.FluentValidation

Rule-builder extensions for FluentValidation's AbstractValidator pipeline.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.7 182 4/20/2026
0.1.0-alpha.6 72 4/20/2026
0.1.0-alpha.5 85 4/18/2026