Popularity
9.5
Stable
Activity
8.4
Declining
6,101
287
956

Code Quality Rank: L5
Programming language: C#
License: Apache License 2.0
Tags: Misc    
Latest version: v9.3.0

FluentValidation alternatives and similar packages

Based on the "Misc" category.
Alternatively, view FluentValidation alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of FluentValidation or a related project?

Add another 'Misc' Package

README

Full Documentation

A small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules.

Get Started

FluentValidation can be installed using the Nuget package manager or the dotnet CLI.

dotnet add package FluentValidation

For ASP.NET Core integration:

dotnet add package FluentValidation.AspNetCore

Sponsorship

If you find FluentValidation useful, please consider becoming a sponsor, which will help keep the project going ๐Ÿ™.


Build Status

FluentValidation NuGet Nuget
FluentValidation.AspNetCore NuGet Nuget
FluentValidation.Mvc5 NuGet Nuget
FluentValidation.WebApi NuGet Nuget

Example

using FluentValidation;

public class CustomerValidator: AbstractValidator<Customer> {
  public CustomerValidator() {
    RuleFor(x => x.Surname).NotEmpty();
    RuleFor(x => x.Forename).NotEmpty().WithMessage("Please specify a first name");
    RuleFor(x => x.Discount).NotEqual(0).When(x => x.HasDiscount);
    RuleFor(x => x.Address).Length(20, 250);
    RuleFor(x => x.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode");
  }

  private bool BeAValidPostcode(string postcode) {
    // custom postcode validating logic goes here
  }
}

var customer = new Customer();
var validator = new CustomerValidator();
ValidationResult results = validator.Validate(customer);

bool success = results.IsValid;
IList<ValidationFailure> failures = results.Errors;

Documentation

Documentation can be found on the project site.

FluentValidation has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

FluentValidation is copyright © 2008-2020 .NET Foundation, Jeremy Skinner and other contributors and is licensed under the Apache2 license.

.NET Foundation

This project is supported by the .NET Foundation.

JetBrains

This project is supported by JetBrains, who kindly provide licenses for their software, free of charge, to help with the development of this project.


*Note that all licence references and agreements mentioned in the FluentValidation README section above are relevant to that project's source code only.