Muonroi.RuleEngine.SourceGenerators 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Muonroi.RuleEngine.SourceGenerators --version 2.0.1
                    
NuGet\Install-Package Muonroi.RuleEngine.SourceGenerators -Version 2.0.1
                    
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.SourceGenerators" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Muonroi.RuleEngine.SourceGenerators" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Muonroi.RuleEngine.SourceGenerators" />
                    
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.SourceGenerators --version 2.0.1
                    
#r "nuget: Muonroi.RuleEngine.SourceGenerators, 2.0.1"
                    
#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.SourceGenerators@2.0.1
                    
#: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.SourceGenerators&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Muonroi.RuleEngine.SourceGenerators&version=2.0.1
                    
Install as a Cake Tool

Muonroi.RuleEngine.SourceGenerators

NuGet

Roslyn source generators and code analyzers for compile-time rule extraction and validation in the Muonroi ecosystem.

Installation

dotnet add package Muonroi.RuleEngine.SourceGenerators

Overview

Automates rule registration and generation at compile time. Using ExtractAsRuleGenerator, methods decorated with [MExtractAsRule] are converted into strongly-typed rule classes. It also includes RuleRegistrationGenerator and RuleCatalogRegistrationGenerator to automatically generate dependency injection code, eliminating manual boilerplate.

Features

  • Code Extraction: ExtractAsRuleGenerator transforms [MExtractAsRule] methods into highly-optimized .g.cs rule classes.
  • Auto-Registration: Generates MGeneratedRuleRegistrationExtensions.g.cs via RuleRegistrationGenerator for frictionless DI setup.
  • Ecosystem Analyzers: Roslyn analyzers (MBB001–MBB007) enforce architectural boundaries and rule safety at compile time.
  • FEEL Validation: Validates inline FEEL expressions at compile time via FeelExpressionSyntaxValidator.
  • Code Fixes: Provides one-click Roslyn auto-fixes for detected rule engine violations.

Quick Start

Add the package to your project. It runs automatically during compilation.

// 1. Mark a method for rule extraction
[MExtractAsRule("FraudDetection")]
public bool IsFraudulent(OrderContext context) => context.Amount > 10000;

// 2. Register generated rules at startup
builder.Services.AddMGeneratedRules();

Ecosystem Combinations

+ RuleEngine.Core → Frictionless Rule Authoring

Eliminates the need to manually implement IRule<TContext>. Write pure functions and let the source generator create the necessary boilerplate for the RuleOrchestrator.

+ RuleGen CLI → Command Line Extraction

Works alongside tools/Muonroi.RuleGen to extract rules to disk and verify compilation targets via CompileCheckService.

Samples

License

Apache 2.0 — see LICENSE-APACHE.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 100 8/26/2026
2.0.1 101 8/26/2026
2.0.0 135 8/14/2026