Bondarukini.Validator 10.0.0

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

Bondarukini.Validator

A lightweight, dependency-free validation library for .NET, inspired by FluentValidation.
Provides a simple, fluent API for defining and running validation rules.


✨ Features

  • Fluent, chainable syntax

    RuleFor(x => x.Name)
        .NotEmpty()
        .MinimumLength(3)
        .WithMessage("Name must be at least 3 characters long.");
    
  • Built-in rule set

    • NotEmpty()
    • MinimumLength(int)
    • GreaterThan(IComparable)
    • GreaterThanOrEqualTo(IComparable)
    • LessThan(IComparable)
    • LessThanOrEqualTo(IComparable)
  • Supports both synchronous and asynchronous validation

  • Works perfectly with Bondarukini.Mediator pipeline behaviors

  • Provides a ValidationContext for additional runtime data


πŸš€ Installation

dotnet add package Bondarukini.Validator

πŸ’‘ Example Usage

using Bondarukini.Validator;
using Bondarukini.Validator.Results;

public class CreateProductCommand
{
    public string Name { get; set; } = "";
    public decimal Price { get; set; }
}

public class CreateProductCommandValidator : ValidatorBase<CreateProductCommand>
{
    public CreateProductCommandValidator()
    {
        RuleFor(x => x.Name)
            .NotEmpty()
            .MinimumLength(3)
            .WithMessage("Product name must be at least 3 characters long.");

        RuleFor(x => x.Price)
            .GreaterThan(0)
            .WithMessage("Price must be greater than zero.");
    }

    // Example of custom async validation
    public override async Task<ValidationResult> ValidateAsync(CreateProductCommand instance, CancellationToken ct = default)
    {
        var result = base.Validate(instance);
        await Task.Delay(10); // simulate async logic

        if (instance.Name == "Forbidden")
            result.Errors.Add(new ValidationFailure(nameof(instance.Name), "This product name is not allowed."));

        return result;
    }
}

🧱 Integration

To automatically execute validators inside your request pipeline, use
ValidatorBehaviour<TRequest, TResponse> from Bondarukini.Mediator.Behaviors:

services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidatorBehaviour<,>));

Package Description
Bondarukini.Mediator Core Mediator implementation
Bondarukini.Mediator.Behaviors Validation & Transaction pipeline behaviors
Bondarukini.Mediator.DependencyInjection Auto-registration for Mediator & Validators

πŸ§‘β€πŸ’» Author

Yurii Bondaruk
Clean, extensible, and minimalistic architecture tools for .NET πŸ‡ΊπŸ‡¦

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 (2)

Showing the top 2 NuGet packages that depend on Bondarukini.Validator:

Package Downloads
Bondarukini.Mediator

Lightweight Mediator pattern implementation for .NET with no dependencies.

Bondarukini.Validation.DependencyInjection

Lightweight Mediator pattern implementation for .NET with no dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0 174 3/11/2026
9.0.0 151 3/11/2026
8.1.0 407 10/6/2025