MonkeyValidator 1.0.0
dotnet add package MonkeyValidator --version 1.0.0
NuGet\Install-Package MonkeyValidator -Version 1.0.0
<PackageReference Include="MonkeyValidator" Version="1.0.0" />
<PackageVersion Include="MonkeyValidator" Version="1.0.0" />
<PackageReference Include="MonkeyValidator" />
paket add MonkeyValidator --version 1.0.0
#r "nuget: MonkeyValidator, 1.0.0"
#:package MonkeyValidator@1.0.0
#addin nuget:?package=MonkeyValidator&version=1.0.0
#tool nuget:?package=MonkeyValidator&version=1.0.0
Monkey validator ⇒ a Linq approach to validation
This library aims at making validation easy, fluent and versatile.
Types of Validation
On The Fly
Use this type of validation anywhere in your code. Just called the GetValidator() on any object and start chaining your validation.

Reusable
Create an ad-hoc validator class inheriting from CustomMonkeyValidatorBase<T> and build your validator in the abstract SetupValidator() method.

validators can be chained, and the validation will pickup all errors before throwing.

Conditional Validation
You can use an if/else if/else logic for more complex scenarios

Fail Fast
If you want to break the validation if a certain condition is met, you can use the FailFastIf() extension, which will throw immediatelly if the predicate returns false.

Custom On Fail
If you want to insert your own logic on validation failure, you can use the overload that takes an Action<List<string>> where List<string> are the validation errors.

You can set the optional throwMonkeyException flag to true if you just want to add some logic before the default exception is thrown.

Custom Rules
For on the fly, one time only custom rules, you can simply chain a CustomRule() and pass in your predicate.

For rules you want to reuse, but are not specific enough to put on a Validator class, I'd recommend creating a static class to extend the MonkeyValidator<T> with your rule fragments:

which you can then chain to your other validators.

| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.Http (>= 2.2.2)
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 |
|---|