StrongOf.FluentValidation 3.1.2

Requires NuGet 2.12 or higher.

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

StrongOf.FluentValidation

FluentValidation extensions for StrongOf types.

NativeAOT boundary

This extension does not promise NativeAOT compatibility for its FluentValidation dependency. Its source is checked with the AOT and trimming analyzers, but the assembly is not marked IsAotCompatible and the repository's native smoke test does not cover FluentValidation.

For validation without that dependency, use IValidatable, StrongValidation.TryCreate or StrongValidation.Require from the AOT-compatible core package. Applications using FluentValidation must publish and test their complete validator configuration and dependencies separately.

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(Func<T,TStrong?>, string) Type-specific validators that support comparisons Must equal another property; pass accessor and member name
IsNotEqualTo(Func<T,TStrong?>, string) Type-specific validators that support comparisons Must not equal another property; pass accessor and member name

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 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
3.1.2 113 10/4/2026
3.0.35 109 9/23/2026
3.0.31 180 6/17/2026
3.0.29 130 5/19/2026
2.1.37 145 4/21/2026
2.1.31 146 3/30/2026
2.1.26 138 3/7/2026
2.1.8 153 2/28/2026
1.2.15 553 4/26/2025
1.2.8 274 4/9/2025
1.2.7 275 2/18/2025
1.2.7-ga639164e54 194 2/18/2025
1.2.4 423 11/28/2024
1.2.4-g0988d2c02d 222 11/28/2024
1.2.2 456 11/15/2024
1.2.2-gbc3f3048e7 185 11/15/2024
1.1.4 260 11/12/2024
1.1.4-g6e854f6d6d 195 11/12/2024
1.1.2 252 11/5/2024
1.1.2-g0a1a51912f 179 11/5/2024
Loading failed