FoolProof.Core 2.1.0

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

Starting from the migration to asp.net core of the MVC Foolproof Validation library.

Validation attributes at your disposal.

Validators to compare with other property:

  • Is (base class)
  • EqualTo
  • NotEqualTo
  • GreaterThan
  • LessThan
  • GreaterThanOrEqualTo
  • LessThanOrEqualTo
  • In (field must be in dependant)
  • NotIn (field must not be in dependant)

Validators to compare with specific values:

  • Is<T> (base class)
  • EqualTo<T>
  • NotEqualTo<T>
  • GreaterThan<T>
  • LessThan<T>
  • GreaterThanOrEqualTo<T>
  • LessThanOrEqualTo<T>
  • In<T>
  • NotIn<T>
  • IsEmpty
  • IsTrue
  • IsFalse

Improved required validators:

  • RequiredIf (field required if dependant satisfy condition)
  • RequiredIfNot (field required if dependant doesn't satisfy condition)
  • RequiredIfTrue (field required if dependant value is true)
  • RequiredIfFalse (field required if dependant value is false)
  • RequiredIfEmpty (field required if dependant has no value)
  • RequiredIfNotEmpty (field required if dependant has value)
  • RequiredIfRegExMatch (field required if dependant match regex)
  • RequiredIfNotRegExMatch (field required if dependant doesn't match regex)
  • RegularExpressionIf (field must match regex if dependant satisfy condition)

Predicate validators: Predicate validators will allow you to create complex validation rules (logical predicates), combining other validators (inlcuding the predicate ones).

  • Predicate (base abstract class)
  • Not(operand)
  • And(operand1, operand2,..., operandN)
  • Or(operand1, operand2,..., operandN)
  • IsValid(property, operand)

operand could be any ValidationAttribute, inlcuding the predicate ones, so you can recursively combine validators to build any logical predicate.

IsValid will let you validate any property in the model, using any existing ValidationAttribute; so combining the predicate validators and the IsValid validator, you can create validation rules to be evaluated at the model level (aka model-wise validation).

Client-side validation

All the validators are available for client side validation. Although you can combine any ValidationAttribute using the predicate validators, only the ValidationAttribute with a registered IAttributeAdapter will be available for client-side validation; of course, this includes all the validator provided by this library (and many others from System.ComponentModel.DataAnnotations).

This library provides you with an HTML helper method ModelValidation to render the model-wise validation as you would do with any property validation. To bring this helper in context, you need to include the FoolProof.Core namespace with the @using directive. Take a look at the predicate page in the example app.

Installation

NuGet: install-package FoolProof.Core

Setting Up

  • Include namespace FoolProof.Core
  • Just add this line services.AddFoolProof(); to your ConfigureServices method on the Startup class; this will register a new IValidationAttributeAdapterProvider.

Example WebApp

You can review a kind of DEMO app (the WebApp used to execute the E2E tests) here: E2E/Demo WebApp

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 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 is compatible.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.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
2.1.0 293 9/12/2025
2.0.0 12,957 4/23/2025
1.3.1 50,642 11/9/2024
1.3.0 7,721 10/3/2024
1.2.1 214,216 6/16/2023
1.2.0 50,925 2/1/2023
1.1.35 89,548 9/1/2022
1.1.10 97,244 12/9/2021
1.1.9 200,948 10/22/2020
1.1.8 16,283 7/28/2020
1.1.4 10,586 6/8/2020
1.0.9 35,221 6/18/2019
1.0.6 857 6/10/2019

- Fix client-side validation when using composite models (properties with a '.' on the name).
- Update **RequiredIf** validators to better auto-assign the _DataType_ to improve the compare operations in client-side.