vali-flow 1.0.1

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

ValiFlow - Fluent Validation for .NET

Introduction 🚀

ValiFlow is a fluent validation library for .NET that allows you to define validation rules in a readable and structured way. It supports various data types and provides methods to validate collections, numbers, dates, and strings efficiently.

Installation 📦

To install ValiFlow via NuGet, run the following command:

 dotnet add package vali-flow

Usage 🛠️

Basic Example

var validator = new ValiFlow<Product>()
    .NotNull(p => p.Name)
    .GreaterThan(p => p.Price, 0)
    .IsToday(p => p.CreatedAt);

bool result = validator.Evaluate(product);

Methods Overview 📝

Evaluate

Validates a single entity based on the defined rules.

var validator = new ValiFlow<Product>()
    .NotNull(p => p.Name)
    .GreaterThan(p => p.Price, 0);

bool isValid = validator.Evaluate(product);

EvaluateAll 🔄

Validates multiple entities at once and returns a dictionary with validation results.

var products = new List<Product> { product1, product2, product3 };
var validator = new ValiFlow<Product>()
    .NotNull(p => p.Name)
    .GreaterThan(p => p.Price, 0);

var results = validator.EvaluateAll(products);

Build 🏗️

It creates the whole set of expressions to use at our convenience, either filtering in linq or with EF.

var validator = new ValiFlow<Product>()
    .NotNull(p => p.Name)
    .GreaterThan(p => p.Price, 0);

Expression<Func<Product, bool>> isValid = validator..Build();

Comparison: Without vs. With ValiFlow ⚖️

Without ValiFlow (Manual Validation)

if (string.IsNullOrEmpty(product.Name)) throw new Exception("Name cannot be null");
if (product.Price <= 0) throw new Exception("Price must be greater than 0");
if (product.CreatedAt.Date != DateTime.Today) throw new Exception("Invalid creation date");

With ValiFlow (Fluent Validation)

var validator = new ValiFlow<Product>()
    .NotNull(p => p.Name)
    .GreaterThan(p => p.Price, 0)
    .IsToday(p => p.CreatedAt);

bool result = validator.Evaluate(product);

News

  • New Method for string that allows to filter a n number of properties based on a value
  • Improved AddSubGroup() validation

Donations 💖

If you find ValiFlow useful and would like to support its development, consider making a donation:

Your contributions help keep this project alive and improve its development! 🚀

License 📜

This project is licensed under the Apache License 2.0.

Contributions 🤝

Feel free to open issues and submit pull requests to improve this library!

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 was computed.  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 was computed.  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.
  • net7.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.

Version Downloads Last updated
1.1.0 132 4/28/2025
1.0.1 111 2/12/2025
1.0.0 109 2/10/2025

-New Method for string that allows to filter a n number of properties based on a value.
           -Improved AddSubGroup() validation.