Project Description
A small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules for your business objects.
If you find FluentValidation useful, please consider making a donation.
![Donate to Jeremy's hosting costs Donate to Jeremy's hosting costs]()
The main source code repository for this project is on GitHub although it is also mirrored to CodePlex.
NuGet packages are available - the package IDs are FluentValidation and FluentValidation.MVC3.
Example
Documentation
Supported By
![ReSharper ReSharper]()
![NDepend NDepend]()
NDepend is a Visual Studio tool to manage complex .NET code and achieve high Code Quality
A small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules for your business objects.
If you find FluentValidation useful, please consider making a donation.

The main source code repository for this project is on GitHub although it is also mirrored to CodePlex.
NuGet packages are available - the package IDs are FluentValidation and FluentValidation.MVC3.
Example
using FluentValidation; public class CustomerValidator: AbstractValidator<Customer> { public CustomerValidator() { RuleFor(customer => customer.Surname).NotEmpty(); RuleFor(customer => customer.Forename).NotEmpty().WithMessage("Please specify a first name"); RuleFor(customer => customer.Company).NotNull(); RuleFor(customer => customer.Discount).NotEqual(0).When(customer => customer.HasDiscount); RuleFor(customer => customer.Address).Length(20, 250); RuleFor(customer => customer.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode"); } private bool BeAValidPostcode(string postcode) { // custom postcode validating logic goes here } } Customer customer = new Customer(); CustomerValidator validator = new CustomerValidator(); ValidationResult results = validator.Validate(customer); bool validationSucceeded = results.IsValid; IList<ValidationFailure> failures = results.Errors;
Documentation
Supported By
NDepend is a Visual Studio tool to manage complex .NET code and achieve high Code Quality