StrongOf.FluentValidation 2.1.8

Requires NuGet 2.12 or higher.

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

StrongOf.FluentValidation

FluentValidation extensions for StrongOf types.

Why Not NotNull()?

For strong types, NotNull() only checks the object reference. StrongOf provides HasValue() which covers both nullability and empty values:

public sealed class UserValidator : AbstractValidator<User>
{
    public UserValidator()
    {
        RuleFor(x => x.UserId)
            .HasValue()            // not NotNull()
            .WithMessage("User ID is required.");

        RuleFor(x => x.Email)
            .HasValue()
            .WithMessage("Email is required.");
    }
}

Available Extensions

Common (all strong types)

Method Applies To Description
HasValue() All strong types Not null and, for string types, not empty/whitespace
IsEqualTo(expr) All strong types Must equal another property of the same type
IsNotEqualTo(expr) All strong types Must not equal another property of the same type

StrongString

Method Description
HasMinimumLength(int) Minimum character length
HasMaximumLength(int) Maximum character length
IsRegexMatch(Regex) Must match a regular expression
AllowedChars(ICollection<char>, string) Must only contain characters from the allowed set

StrongInt32 / StrongInt64

Method Description
HasMinimum(int/long) Value must be ≥ min
HasMaximum(int/long) Value must be ≤ max
HasRange(int/long, int/long) Value must be within [min, max]

StrongDateTime / StrongDateTimeOffset

Method Description
HasMinimum(DateTime/DateTimeOffset) Value must be ≥ min
HasMaximum(DateTime/DateTimeOffset) Value must be ≤ max
HasRange(DateTime/DateTimeOffset, ...) Value must be within [min, max]

Installation

dotnet add package StrongOf.FluentValidation

GitHub

See https://github.com/BenjaminAbt/StrongOf

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.8 84 2/28/2026
1.2.15 505 4/26/2025
1.2.8 229 4/9/2025
1.2.7 229 2/18/2025
1.2.7-ga639164e54 155 2/18/2025
1.2.4 371 11/28/2024
1.2.4-g0988d2c02d 173 11/28/2024
1.2.2 415 11/15/2024
1.2.2-gbc3f3048e7 143 11/15/2024
1.1.4 213 11/12/2024
1.1.4-g6e854f6d6d 162 11/12/2024
1.1.2 212 11/5/2024
1.1.2-g0a1a51912f 141 11/5/2024
0.1.71 193 11/3/2024
0.1.71-g40ec49b665 160 11/3/2024
0.1.65 281 6/2/2024
0.1.65-g31f777a546 184 6/2/2024
0.1.63 194 6/1/2024
0.1.63-g3ca390c476 168 6/1/2024
0.1.61 249 4/29/2024
Loading failed