PineGuard.MustClauses
0.1.0-alpha.7
dotnet add package PineGuard.MustClauses --version 0.1.0-alpha.7
NuGet\Install-Package PineGuard.MustClauses -Version 0.1.0-alpha.7
<PackageReference Include="PineGuard.MustClauses" Version="0.1.0-alpha.7" />
<PackageVersion Include="PineGuard.MustClauses" Version="0.1.0-alpha.7" />
<PackageReference Include="PineGuard.MustClauses" />
paket add PineGuard.MustClauses --version 0.1.0-alpha.7
#r "nuget: PineGuard.MustClauses, 0.1.0-alpha.7"
#:package PineGuard.MustClauses@0.1.0-alpha.7
#addin nuget:?package=PineGuard.MustClauses&version=0.1.0-alpha.7&prerelease
#tool nuget:?package=PineGuard.MustClauses&version=0.1.0-alpha.7&prerelease
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
- Constructors and service boundaries that should fail fast → PineGuard.GuardClauses
- Already using FluentValidation → PineGuard.FluentValidation
- Attribute-driven models (DTOs, MVC binding, Blazor) → PineGuard.DataAnnotations
See the full documentation for the complete Must.Be.* catalog.
License
MIT © Steve McCormack
| Product | Versions 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. |
-
.NETStandard 2.1
- PineGuard.Core (>= 0.1.0-alpha.7)
-
net10.0
- PineGuard.Core (>= 0.1.0-alpha.7)
-
net8.0
- PineGuard.Core (>= 0.1.0-alpha.7)
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 |