
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
NetRuleEngine
Advanced tools
C# Rule Engine. High performance object rule matching. Support various complex grouped predicates.
C# simple Rule Engine. High performance object rule matching. Support various complex grouped predicates. available on nuget.
(Input) An Object + Rule(s) => (Output) Is Match
flowchart LR
User((Rules Admin<br/>User))
Editor[Rule<br/>Editor UI]
DB[(Rules DB)]
Event[Business Event<br/><i>real time</i>]
Logic[Business Logic]
Engine[NetRuleEngine]
User -->|configures rules| Editor
Editor -->|SAVE AS JSON| DB
Event -->|trigger| Logic
Logic -->|1.fetch rules| DB
Logic -->|2.check event<br/>against rules| Engine
Engine -->|matching rules| Logic
The engine supports unlimited nesting of rule groups, allowing for complex logical expressions. RulesGroups can contain both individual Rules and other RulesGroups, enabling sophisticated rule combinations like:
(A AND (B OR C))(A OR B) AND (C OR (D AND E))((A OR B) AND C) OR (D AND (E OR F))Example of a complex nested rule:
var config = new RulesConfig {
RulesOperator = Rule.InterRuleOperatorType.And,
RulesGroups = [
new RulesGroup {
Operator = Rule.InterRuleOperatorType.Or,
Rules = [
new Rule {
ComparisonOperator = Rule.ComparisonOperatorType.Equal,
ComparisonValue = "example",
ComparisonPredicate = "TextField"
},
new RulesGroup {
Operator = Rule.InterRuleOperatorType.And,
Rules = [
new RulesGroup {
Operator = Rule.InterRuleOperatorType.Or,
Rules = [
new Rule {
ComparisonOperator = Rule.ComparisonOperatorType.GreaterThan,
ComparisonValue = "10",
ComparisonPredicate = "NumericField"
}
]
}
]
}
]
}
]
};
and many more. See units test for full usage scenarios.
IRulesService<TestModel> engine = RulesService<TestModel>.CreateDefault();
var matching = engine.GetMatchingRules(
new TestModel { NumericField = 5 },
new[] {
new RulesConfig {
Id = Guid.NewGuid(),
RulesOperator = Rule.InterRuleOperatorType.And,
RulesGroups = new RulesGroup[] {
new RulesGroup {
Operator = Rule.InterRuleOperatorType.And,
// every TestModel instance with NumericField Equal to 5 will match this rule
Rules = new[] {
new Rule {
ComparisonOperator = Rule.ComparisonOperatorType.Equal,
ComparisonValue = 5.ToString(),
ComparisonPredicate = nameof(TestModel.NumericField)
}
}
}
}
}
});
Rule Editor UI Example (not included in this project):

Rule Config JSON Format Example:
{
"Id": "123000000-0000-0000-0000-000000000000",
"RulesOperator": "And",
"RulesGroups": [
{
"Operator": "Or",
"Rules": [
{
"ComparisonPredicate": "TextField",
"ComparisonOperator": "StringStartsWith",
"ComparisonValue": "NOT MATCHING PREFIX",
},
{
"Operator": "And",
"Rules": [
{
"ComparisonPredicate": "NumericField",
"ComparisonOperator": "GreaterThan",
"ComparisonValue": "10",
},
{
"ComparisonPredicate": "TextField",
"ComparisonOperator": "Equal",
"ComparisonValue": "example",
}
]
}
]
}
]
}
This example demonstrates a nested rule structure where:
Best practice would be to decouple the Property names from the way they would be used within the rules (the same concept that JsonPropertyAttribute follows when (de)serializing from/to json). this way, renaming the properties will not break the existing rules.
use RulePredicatePropertyAttribute to name the rule predicate property, otherwise the property name will be used as predicate name.
[RulePredicateProperty("first_name")]
public string FirstName { get; set; }
first_name will be used as predicate name instead of the property name (FirstName), and you will be able to rename the property name (FirstName) without breaking the rules.
as your rule will be written as:
{
"ComparisonPredicate": "first_name",
"ComparisonOperator": "Equal",
"ComparisonValue": "John"
}
for example
see TestModelWithComparisonPredicateNameAttribute for more examples
FAQs
C# Rule Engine. High performance object rule matching. Support various complex grouped predicates.
We found that netruleengine demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.