lousystems.FluentValidation.Extensions 1.0.14

Additional Details

lousystems.FluentValidation.Extensions update to newer version

There is a newer version of this package available.
See the version list below for details.
dotnet add package lousystems.FluentValidation.Extensions --version 1.0.14
                    
NuGet\Install-Package lousystems.FluentValidation.Extensions -Version 1.0.14
                    
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="lousystems.FluentValidation.Extensions" Version="1.0.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="lousystems.FluentValidation.Extensions" Version="1.0.14" />
                    
Directory.Packages.props
<PackageReference Include="lousystems.FluentValidation.Extensions" />
                    
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 lousystems.FluentValidation.Extensions --version 1.0.14
                    
#r "nuget: lousystems.FluentValidation.Extensions, 1.0.14"
                    
#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 lousystems.FluentValidation.Extensions@1.0.14
                    
#: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=lousystems.FluentValidation.Extensions&version=1.0.14
                    
Install as a Cake Addin
#tool nuget:?package=lousystems.FluentValidation.Extensions&version=1.0.14
                    
Install as a Cake Tool

lousystems.FluentValidation.Extensions

A collection of lightweight, reusable validation extensions for FluentValidation. Designed to simplify complex business rules and maintain clean, readable validators in modern .NET applications.

🚀 Installation

Install the package via .NET CLI:

dotnet add package lousystems.FluentValidation.Extensions

Or via the NuGet Package Manager:

Install-Package lousystems.FluentValidation.Extensions


🛠 Features & Usage

This library extends IRuleBuilder to provide specialized validation logic out of the box.

1. Service Name Validation

Validates strings against common cloud-resource naming conventions (e.g., lowercase, hyphens, specific length).

public class MyRequestValidator : AbstractValidator<MyRequest>
{
    public MyRequestValidator()
    {
        // Mandatory field
        RuleFor(x => x.ServiceName).MustBeServiceName();

        // Optional field: Only validates if not null
        RuleFor(x => x.OptionalService).MustBeServiceNameIfNotNull();
    }
}

2. Conditional Logic

The extensions are built using ApplyConditionTo.AllValidators, ensuring that entire rule chains are correctly skipped when properties are null, preventing unintended validation failures.


🏗 Technical Specifications

  • Target Frameworks: .NET 8.0, .NET 9.0, and .NET 10.0 (LTS).
  • Dependency: FluentValidation (>= 11.0.0).
  • Native AOT Ready: This library does not use reflection at runtime and is fully compatible with Native AOT (Ahead-of-Time) compilation for high-performance cloud-native workloads.

⚖ License

This project is licensed under the MIT License. See the LICENSE file for more information.

🤝 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request on our GitHub Repository.


Technical Implementation Note

When using the IfNotNull variants, the library handles the internal state by wrapping rules in a When condition. This keeps your validator code clean while ensuring strict type safety and null-handling.

Would you like me to add a specific section for Unit Testing these extensions to show your users how to verify their rules?

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.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.