All Projects → microsoft → Rulesengine

microsoft / Rulesengine

Licence: mit
A Json based Rules Engine with extensive Dynamic expression support

Projects that are alternatives of or similar to Rulesengine

Kogito Examples
Kogito examples - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
Stars: ✭ 96 (-86.55%)
Mutual labels:  rules-engine, workflow
Svg
Fork of the ms svg library (http://svg.codeplex.com/)
Stars: ✭ 676 (-5.32%)
Mutual labels:  nuget
Smartflow Sharp
基于C#语言研发的Smartflow-Sharp工作流组件,该工作流组件的特点是简单易用、方便扩展、支持多种数据库访问、高度可定制化,支持用户按需求做功能的定制开发,节省用户的使用成本
Stars: ✭ 594 (-16.81%)
Mutual labels:  workflow
Wfd
flowable workflow designer base on @antv/g6
Stars: ✭ 639 (-10.5%)
Mutual labels:  workflow
Cron Expression Descriptor
A .NET library that converts cron expressions into human readable descriptions.
Stars: ✭ 602 (-15.69%)
Mutual labels:  nuget
Xamarinmediamanager
Cross platform Xamarin plugin to play and control Audio and Video
Stars: ✭ 647 (-9.38%)
Mutual labels:  nuget
Fastshell
Fiercely quick front-end boilerplate and workflows, HTML5, Gulp, Sass
Stars: ✭ 563 (-21.15%)
Mutual labels:  workflow
Dext
🔍 A smart launcher. Powered by JavaScript.
Stars: ✭ 713 (-0.14%)
Mutual labels:  workflow
Wordpress Gulp Starter Kit
[NOT MAINTAINED] A starter kit for developing WordPress themes with Gulp.
Stars: ✭ 674 (-5.6%)
Mutual labels:  workflow
Winsw
A wrapper executable that can run any executable as a Windows service, in a permissive license.
Stars: ✭ 6,569 (+820.03%)
Mutual labels:  nuget
X.pagedlist
Library for easily paging through any IEnumerable/IQueryable in ASP.NET/ASP.NET Core
Stars: ✭ 625 (-12.46%)
Mutual labels:  nuget
Django River
Django workflow library that supports on the fly changes ⛵
Stars: ✭ 609 (-14.71%)
Mutual labels:  workflow
Cromwell
Scientific workflow engine designed for simplicity & scalability. Trivially transition between one off use cases to massive scale production environments
Stars: ✭ 655 (-8.26%)
Mutual labels:  workflow
Openrpa
Free Open Source Enterprise Grade RPA
Stars: ✭ 596 (-16.53%)
Mutual labels:  workflow
React Design Editor
React Design Editor has started to developed direct manipulation of editable design tools like Powerpoint, We've developed it with reactjs, ant.design, fabricjs
Stars: ✭ 687 (-3.78%)
Mutual labels:  workflow
Vs Threading
The Microsoft.VisualStudio.Threading is a xplat library that provides many threading and synchronization primitives used in Visual Studio and other applications.
Stars: ✭ 585 (-18.07%)
Mutual labels:  nuget
Orchestra
Orchestra is a Robotic Process Automation system for orchestrating project teams of experts and machines.
Stars: ✭ 614 (-14.01%)
Mutual labels:  workflow
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (-9.94%)
Mutual labels:  nuget
Rules
No description, website, or topics provided.
Stars: ✭ 6,421 (+799.3%)
Mutual labels:  workflow
Ngx Graph
Graph visualization library for angular
Stars: ✭ 704 (-1.4%)
Mutual labels:  workflow

Rules Engine

build Coverage Status Nuget download

Overview

Rules Engine is a library/NuGet package for abstracting business logic/rules/policies out of the system. This works in a very simple way by giving you an ability to put your rules in a store outside the core logic of the system thus ensuring that any change in rules doesn't affect the core system.

Installation

To install this library, please download the latest version of NuGet Package from nuget.org and refer it into your project.

How to use it

You need to store the rules based on the schema definition given and they can be stored in any store as deemed appropriate like Azure Blob Storage, Cosmos DB, Azure App Configuration, SQL Servers, file systems etc. The expressions are supposed to be a lambda expressions.

An example rule could be -

[
  {
    "WorkflowName": "Discount",
    "Rules": [
      {
        "RuleName": "GiveDiscount10",
        "SuccessEvent": "10",
        "ErrorMessage": "One or more adjust rules failed.",
        "ErrorType": "Error",
        "RuleExpressionType": "LambdaExpression",
        "Expression": "input1.country == \"india\" AND input1.loyalityFactor <= 2 AND input1.totalPurchasesToDate >= 5000"
      },
      {
        "RuleName": "GiveDiscount20",
        "SuccessEvent": "20",
        "ErrorMessage": "One or more adjust rules failed.",
        "ErrorType": "Error",
        "RuleExpressionType": "LambdaExpression",
        "Expression": "input1.country == \"india\" AND input1.loyalityFactor >= 3 AND input1.totalPurchasesToDate >= 10000"
      }
    ]
  }
]

You can inject the rules into the Rules Engine by initiating an instance by using the following code -

var rulesEngine = new RulesEngine(workflowRules, logger);

Here, workflowRules is a list of deserialized object based out of the schema explained above and logger is a custom logger instance made out of an ILogger instance.

Once done, the Rules Engine needs to execute the rules for a given input. It can be done by calling the method ExecuteAllRulesAsync as shown below -

List<RuleResultTree> response = await rulesEngine.ExecuteAllRulesAsync(workflowName, input);

Here, workflowName is the name of the workflow, which is Discount in the above mentioned example. And input is the object which needs to be checked against the rules.

The response will contain a list of RuleResultTree which gives information if a particular rule passed or failed.

Note: A detailed example showcasing how to use Rules Engine is explained in Getting Started page of Rules Engine Wiki.

A demo app for the is available at this location.

How it works

The rules can be stored in any store and be fed to the system in a structure which follows a proper schema of WorkFlow model.

The wrapper needs to be created over the Rules Engine package, which will get the rules and input message(s) from any store that your system dictates and put it into the Engine. Also, the wrapper then needs to handle the output using appropriate means.

Note: To know in detail of the workings of Rules Engine, please visit How it works section in Rules Engine Wiki.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.


For more details please check out Rules Engine Wiki.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].