DotNetRuleEngine
.net standard v2
Install / Use
/learn @ayayalar/DotNetRuleEngineREADME
DotNetRuleEngine allows you to write your code as series of rules to keep your code clean and structured. Supports both synchronous and asynchronous patterns and it adheres to S.O.L.I.D design principles.
A few reasons use DotNetRuleEngine
- Adheres to S.O.L.I.D
- Testable code.
- Encapsulates varying behavior. Such as business rules.
PM> Install-Package DotNetRuleEngine
Nuget package available at: DotNetRuleEngine
Get Started at: DotNetRuleEngine Wiki
Example
Model
public class Order
{
public int Id { get; set; }
public decimal Total { get; set; }
public bool FreeShipping { get; set; }
}
Order order = new Order { Id = 1, Total = 79.99 };
Install DotNetRuleEngine
install-package dotnetruleengine
Create Rule(s)
Create a rule to update FreeShipping attribute if the amount is greater than $50.00
public class QualifiesForFreeShipping: Rule<Order>
{
public override IRuleResult Invoke()
{
if (Model.Total > 50.0m)
{
Model.FreeShipping = true;
}
return null;
}
}
Invoke Rule(s)
var ruleResults = RuleEngine<Order>.GetInstance(order)
.ApplyRules(new QualifiesForFreeShipping())
.Execute()
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
