Muonroi.RuleEngine.Core 2.0.2

dotnet add package Muonroi.RuleEngine.Core --version 2.0.2
                    
NuGet\Install-Package Muonroi.RuleEngine.Core -Version 2.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Muonroi.RuleEngine.Core" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Muonroi.RuleEngine.Core" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Muonroi.RuleEngine.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Muonroi.RuleEngine.Core --version 2.0.2
                    
#r "nuget: Muonroi.RuleEngine.Core, 2.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Muonroi.RuleEngine.Core@2.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Muonroi.RuleEngine.Core&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Muonroi.RuleEngine.Core&version=2.0.2
                    
Install as a Cake Tool

Muonroi.RuleEngine.Core

NuGet

Core execution orchestrator for the Muonroi Rule Engine, providing rule evaluation, dependency resolution, and FactBag state management.

Installation

dotnet add package Muonroi.RuleEngine.Core

Overview

The core orchestration layer for executing rule pipelines. It defines RuleOrchestrator<TContext> which implements IMRuleOrchestrator<TContext> to evaluate sequences of IRule<TContext>. State transitions between rules are managed via the FactBag, and each rule returns a RuleResult determining execution flow based on the current ExecutionMode (e.g. AllOrNothing, BestEffort).

Features

  • Engine Configuration: MRuleEngineBuilder for fluent setup of execution options and dependencies.
  • Rule Definitions: IRule<TContext> for defining atomic pieces of logic, with properties for Code, Order, DependsOn, and HookPoint.
  • State Management: FactBag for strongly typed state passing between rules via Get<T>() and Set<T>().
  • Execution Orchestration: IMRuleOrchestrator<TContext> and RuleOrchestrator<TContext> to execute rule chains and aggregate an OrchestratorResult.
  • Execution Modes: Configure behavior on failure via the ExecutionMode enum (AllOrNothing, BestEffort, CompensateOnFailure).

Quick Start

// Configure engine dependencies and defaults
builder.Services.AddRuleEngine<OrderContext>(options =>
{
    options.Mode = ExecutionMode.BestEffort;
});

// Resolve the orchestrator and execute
var orchestrator = provider.GetRequiredService<IMRuleOrchestrator<OrderContext>>();
var result = await orchestrator.ExecuteAsync(new OrderContext(), cancellationToken);

Ecosystem Combinations

+ Mediator → Rules Run Before Every Command

MRuleEngineBehavior in the mediator pipeline calls IMRuleOrchestrator.ExecuteAsync() before the handler. Business rules become hot-reloadable without touching handler code:

public class PlaceOrderCommand : IRequest<OrderDto>, IMRuleRequest
{
    public string RuleContext => "ORDER_PLACEMENT";
}
// Handler is pure — rules evaluated by the pipeline, not the handler

+ Tenancy.Core → Per-Tenant Rule Quotas

ITenantQuotaTracker gates how many rule evaluations a tenant can execute per time window. Free tier: 1,000/day. Enterprise: unlimited.

+ Observability → Per-Rule OTel Spans

Every IRule<TContext>.EvaluateAsync() call becomes an OTel span via IRuleExecutionTracer. Diagnose slow rules in Grafana.

Full Rule Engine Production Stack

builder.Services
    .AddRuleEngine<OrderContext>()             // core orchestrator
    .AddRuleEngineRuntime(config)              // persistence + hot-reload
    .AddTenantContext(config)                  // per-tenant quotas
    .AddMuonroiObservability(config)           // per-rule OTel spans
    .AddMMediator(opt => opt.AddMuonroiEcosystem()); // rules in pipeline

Samples

License

Apache 2.0 — see LICENSE-APACHE.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Muonroi.RuleEngine.Core:

Package Downloads
Muonroi.RuleEngine.Runtime

Runtime orchestration layer for Muonroi RuleEngine, providing execution pipelines and integration points for rule evaluation services.

Muonroi.RuleEngine.Testing

Testing helpers for Muonroi rule orchestration.

Muonroi.Tenancy.SiteProfile.Web

ASP.NET Core middleware and SignalR hot-reload for Muonroi.Tenancy.SiteProfile.

Muonroi.BuildingBlock.All

Metapackage for Muonroi Building Block - Includes all sub-packages for a complete infrastructure setup.

Muonroi.Caching.Redis

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 273 8/26/2026
2.0.1 276 8/26/2026
2.0.0 316 8/14/2026
1.0.0-alpha.14 165 5/15/2026
Loading failed

v1.7.0: Updated to use new Abstractions v1.7.0 with Saga Pattern support. Added 48 new Theory tests for comprehensive edge case coverage.