Skip to content

๐Ÿ“œ Simple and easy to use rule engine in .NET

License

Notifications You must be signed in to change notification settings

dimesoftware/rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Logo

Dime.Rules

Getting Started

  • You must have Visual Studio 2019 Community or higher.
  • The dotnet cli is also highly recommended.

About this project

Simple rule engine.

Build and Test

  • Run dotnet restore
  • Run dotnet build
  • Run dotnet test

Installation

Use the package manager NuGet to install Dime.Rules:

  • dotnet cli: dotnet add package Dime.Rules
  • Package manager: Install-Package Dime.Rules

Usage

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;
}

Contributing

PRs Welcome

Pull requests are welcome. Please check out the contribution and code of conduct guidelines.

License

License