- You must have Visual Studio 2019 Community or higher.
- The dotnet cli is also highly recommended.
Simple rule engine.
- Run dotnet restore
- Run dotnet build
- Run dotnet test
Use the package manager NuGet to install Dime.Rules:
- dotnet cli:
dotnet add package Dime.Rules
- Package manager:
Install-Package Dime.Rules
using Dime.Rules;
public bool Validate(MyClass item)
{
var rule1 = new ValidationRule<Customer>(x => x != null, "Item cannot be null");
var rule2 = new ValidationRule<Customer>(x => x.IsActive == true, "IsActive needs to be true");
ValidationEngine<Customer> engine = new ValidationEngine<Customer>(rule1, rule2);
ValidationResult validationResult = engine.Validate(item);
return validationResult.IsValid;
}
Pull requests are welcome. Please check out the contribution and code of conduct guidelines.